Skip to content
This repository was archived by the owner on Nov 24, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions documentation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ <h3>addAlarmService</h3>
<ul>
<li><b>service</b> - (Required) The full service name from your AndroidManifest.xml to be run.</li>
<li><b>requestCode</b> (Optional) (int) ID for the specific alarm being created. If the requestCode, it will update the saved alarm</li>
<li><b>itemId</b> (Optional) (string) itemId to transfer parameter to service. You can read with:
<pre>Ti.Android.currentService.getIntent().getStringExtra('itemId');</pre></li>

<li><b>second</b> - (Required) (int) The second of the start time. </li>
<li><b>minute</b> - (Required) (int) The minute of the start time. </li>
<li><b>hour</b> - (Optional) (int) The hour you want to start the alarm</li>
Expand Down
10 changes: 9 additions & 1 deletion src/bencoding/alarmmanager/AlarmManagerProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,15 @@ private Intent createAlarmServiceIntent(KrollDict args){
if(hasInterval){
intent.putExtra("alarm_service_interval", intervalValue);
}



//Check if the user has setted an itemId
if((args.containsKeyAndNotNull("itemId"))){
String itemId = (String)args.get("itemId");
intent.putExtra("itemId", itemId);
}
intent.putExtra("test", "TEST");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not contain "test", indentation incorrect.


utils.debugLog("created alarm service intent for " + serviceName
+ "(forceRestart: "
+ (optionIsEnabled(args,"forceRestart") ? "true" : "false")
Expand Down
3 changes: 1 addition & 2 deletions src/bencoding/alarmmanager/AlarmServiceListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public void onReceive(Context context, Intent intent) {
String fullServiceName = bundle.getString("alarm_service_name");
boolean forceRestart = bundle.getBoolean("alarm_service_force_restart",false);
boolean hasInterval = bundle.getBoolean("alarm_service_has_interval",false);

utils.debugLog("Full Service Name: " + fullServiceName);
if (this.isServiceRunning(context,fullServiceName)) {
if(forceRestart){
Expand All @@ -49,7 +48,7 @@ public void onReceive(Context context, Intent intent) {

Intent serviceIntent = new Intent();
serviceIntent.setClassName(TiApplication.getInstance().getApplicationContext(), fullServiceName);
serviceIntent.putExtra("itemId",bundle.getString("itemId","0"));
utils.debugLog("Is this an interval service? " + new Boolean(hasInterval).toString());
if(hasInterval){
utils.debugLog("Is this an interval amount " + bundle.getLong("alarm_service_interval", 45*60*1000L));
Expand Down