Skip to content

Commit

Permalink
MOSYNC-2920 LocalNotification destroy bug: it also cancelled the pend…
Browse files Browse the repository at this point in the history
…ing intent
  • Loading branch information
emmaTresanszki committed Mar 6, 2013
1 parent bc8da0c commit e446d50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
Expand Up @@ -100,35 +100,6 @@ public int destroy(int handle)
LocalNotificationObject notification = m_NotificationTable.get(handle);
if ( null != notification )
{
// Remove the service notification if it is pending.
if ( notification.isActive() )
{
LocalNotificationsService.removeServiceNotification(
m_NotificationTable.get(handle).getId(),
mMoSyncThread.getActivity());

// Stop the service, even when the application is in background.
LocalNotificationsService.stopService();
}
// Cancel the intent assigned to the notification if scheduled.
if ( null != m_Intents.get(handle) )
{
AlarmManager alarmManager =
(AlarmManager) mMoSyncThread.getActivity().getSystemService(Context.ALARM_SERVICE);

// Set the unique request code as the handle.
PendingIntent pendingIntent = PendingIntent.getBroadcast(
mMoSyncThread.getActivity(),
notification.getRequestCode(),
m_Intents.get(handle),
PendingIntent.FLAG_NO_CREATE);
if ( pendingIntent != null )
{
alarmManager.cancel(pendingIntent);
}
m_Intents.remove(handle);
}

// Remove the internal notification object.
m_NotificationTable.remove(handle);

Expand Down Expand Up @@ -296,6 +267,7 @@ public int schedule(final int handle, final Context appContext)
alarmManager.set(AlarmManager.RTC_WAKEUP, notification.getFireDate(), pendingIntent);
m_Intents.put(handle, intent);


return MA_NOTIFICATION_RES_OK;
}
}
Expand Down
9 changes: 4 additions & 5 deletions testPrograms/notification/LocalNotificationSender/ReadMe.txt
Expand Up @@ -4,25 +4,24 @@ On Android only there are two more texts to set:
- content body title and
- the ticker text.
(Ticker text: the text that flows by in the status bar when the notification first activates.)

Next, you can set for iOS only:
- the badge number,
-the alert action (the title of the action button or slider).
Next the Default Sound can be enabled/disabled.

Next the Default Sound can be enabled/disabled.
Below, settings available only on Android:
- the Vibration settings ( that are available only on Android): By checking the Vibration check box, the default
vibration pattern is applied. If the vibration duration is set, it will be used instead.
- the Flash LED settings( that are available only on Android): By checking the Flashing check box, the default flashing
pattern is applied to the notification. If the pattern is set(by filling the next 3 edit boxes), it will be used instead.
If the flashing is not supported on the device you will get the message "Not available" inside the edit boxes for this settings.
Note that you need to enable the Notification LED lights from device's Settings.

The Flashing pattern is consisted of:
- a color, in the format 0xRRGGBB, for instance red: 0xFF0000.
- led on = length of time, in seconds, to keep the light on.
- led off = length of time, in seconds, to keep the light off.
- The "Show only when in background" setting. This is available only on Android. On iOS the user sees the notification only
if the application is running in background. On Android this can be configured: by checking this setting the notification
will be displayed only if the app is running in background. By un-checking it you will get the notification regardless of the
focus state.

The last setting is the fire date: number of seconds for scheduling.

Expand Down

0 comments on commit e446d50

Please sign in to comment.