Details
-
Type:
New Feature
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 3.1.0, 2013 Sprint 04 API, 2013 Sprint 04
-
Component/s: iOS
Description
{html}<div><p><strong><em>Problem</em></strong></p>
<p>When an app is running and a remote push notification is
received, the callback passed to
Ti.Network.registerForPushNotifications is called. This is
fine.</p>
<p>When an app is NOT running and a remote push notification is
received, if the user taps "View" to open the app, the callback is
also called, but NOTHING is included in the event to indicate that
this notification was already displayed to the user and the app was
launched via the "View" button. Thus, the app displays the
notification that the user has already seen.</p>
<p>There are three possible cases:</p>
<ol>
<li>App just launched (by tapped the action button (named "View" by
default) in the notification presented by iOS.<br></li>
<li>App made active (brought from background to foreground, again
by the action button).<br></li>
<li>App already running (in foreground).</li>
</ol>
<p><strong><em>Suggested Obj-C Fix</em></strong></p>
<pre>
<code>FROM:
// check to see upon registration if we were started with a push
// notification and if so, go ahead and trigger our callback
id currentNotification = [[TiApp app] remoteNotification];
if (currentNotification!=nil && pushNotificationCallback!=nil)
{ id event = [NSDictionary dictionaryWithObject:currentNotification forKey:@"data"]; [self _fireEventToListener:@"remote" withObject:event listener:pushNotificationCallback thisObject:nil]; }
TO:
// check to see upon registration if we were started with a push
// notification and if so, go ahead and trigger our callback
id currentNotification = [[TiApp app] remoteNotification];
if (currentNotification!=nil && pushNotificationCallback!=nil)
{ id event = [NSDictionary dictionaryWithObjectsAndKeys:currentNotification, @"data", NUMBOOL(YES), @"firedFromRegister", nil]; [self _fireEventToListener:@"remote" withObject:event listener:pushNotificationCallback thisObject:nil]; }</code>
</pre>
<p>See Ticket Reference for more Detail: <a href=
"http://support.appcelerator.com/tickets/EBJ-28594-463">http://support.appcelerator.com/tickets/EBJ-28594-463</a></p></div>{html}
<p>When an app is running and a remote push notification is
received, the callback passed to
Ti.Network.registerForPushNotifications is called. This is
fine.</p>
<p>When an app is NOT running and a remote push notification is
received, if the user taps "View" to open the app, the callback is
also called, but NOTHING is included in the event to indicate that
this notification was already displayed to the user and the app was
launched via the "View" button. Thus, the app displays the
notification that the user has already seen.</p>
<p>There are three possible cases:</p>
<ol>
<li>App just launched (by tapped the action button (named "View" by
default) in the notification presented by iOS.<br></li>
<li>App made active (brought from background to foreground, again
by the action button).<br></li>
<li>App already running (in foreground).</li>
</ol>
<p><strong><em>Suggested Obj-C Fix</em></strong></p>
<pre>
<code>FROM:
// check to see upon registration if we were started with a push
// notification and if so, go ahead and trigger our callback
id currentNotification = [[TiApp app] remoteNotification];
if (currentNotification!=nil && pushNotificationCallback!=nil)
{ id event = [NSDictionary dictionaryWithObject:currentNotification forKey:@"data"]; [self _fireEventToListener:@"remote" withObject:event listener:pushNotificationCallback thisObject:nil]; }
TO:
// check to see upon registration if we were started with a push
// notification and if so, go ahead and trigger our callback
id currentNotification = [[TiApp app] remoteNotification];
if (currentNotification!=nil && pushNotificationCallback!=nil)
{ id event = [NSDictionary dictionaryWithObjectsAndKeys:currentNotification, @"data", NUMBOOL(YES), @"firedFromRegister", nil]; [self _fireEventToListener:@"remote" withObject:event listener:pushNotificationCallback thisObject:nil]; }</code>
</pre>
<p>See Ticket Reference for more Detail: <a href=
"http://support.appcelerator.com/tickets/EBJ-28594-463">http://support.appcelerator.com/tickets/EBJ-28594-463</a></p></div>{html}
Attachments
Issue Links
- relates to
-
TIMOB-5437 iOS: Expose applicationState property of UIApplication Class
-
- Closed
-