[TIMOB-26437] Ti.Network.registerForPushNotifications callback not working when application resume.
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Resolved |
| Resolution | Duplicate |
| Resolution Date | 2018-10-05T04:01:05.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | ios, ios-12, sdk-7.4.0.GA |
| Reporter | Sathaphorn Kerdmalai |
| Assignee | Vijay Singh |
| Created | 2018-09-25T09:14:57.000+0000 |
| Updated | 2018-10-05T08:22:30.000+0000 |
Description
Ti.Network.registerForPushNotifications callback not working when application resume.
Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() {
// Remove event listener once registered for push notifications
Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush);
Ti.Network.registerForPushNotifications({
success : deviceTokenSuccess,
error : deviceTokenError,
callback : receivePush
});
});
it's working find when application was killed but when application resume and got notification, Open application from notifcation center receivcePush not call.
Attachments
| File | Date | Size |
|---|---|---|
| ScreenRecording_09-28-2018 08-37-14 (1).m4v | 2018-09-28T01:42:38.000+0000 | 4245017 |
Hello, Thanks for sharing this. Can you share full test code to reproduce the issue on our end? Also share your complete environment details.
Here is code when i register push notification.if (parseInt(Ti.Platform.version.split(".")[0]) >= 8) { // Wait for user settings to be registered before registering for push notifications Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() { // Remove event listener once registered for push notifications Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); Ti.Network.registerForPushNotifications({ success : deviceTokenSuccess, error : deviceTokenError, callback : receivePush }); }); // Register notification types to use Ti.App.iOS.registerUserNotificationSettings({ types : [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE] }); }I tested when i killed app will alert when open app from notfication center. after that i send push message again its just only open app but not alert data from push notification.function receivePush(e) { var inBackground = e.inBackground; alert('receivePush ' + JSON.stringify(e)); }Do you have any ideas?. I think on ios12 apple changed how to handle push notification when the application in the foreground.
[~iblack.dum], Thanks for your feedback. Can you send us a screenshot which displays the issue ?
I'll send to you but I think we have to use
to handler push notification when an application on the foreground.- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { } - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response withCompletionHandler:(nonnull void (^)(void))completionHandler { }Hello [~iblack.dum], What's the update of your issue. Does that fix your issue? Send us screenshot which displays the issue. Thanks.
[^ScreenRecording_09-28-2018 08-37-14 (1).m4v] See step from a video. Step 1: Application does not open yet send a push notification will open an application alert data from a push. Step 2: Application on background, and send a push notification will open an application but receviePush function not called. Step 3: Application on a foreground, and send a push notification. It still displays a notification on the notification center.
Hi Sharif, Do you have any ideas? How to fix it?
[~iblack.dum] Can you please verify your issue using sdk 7.4.1 as several notification issues have been fixed in TIMOB-26399? You can get 7.4.1 sdk directly via CLI - appc ti sdk install -b 7_4_X Thanks!
Yes, it's work perfectly. What's time will you release this version officially.
[~iblack.dum]Thanks for confirming. We are running one iOS 12 issue TIMOB-26391. As soon as it get fixed, we will go for release. Thanks!
I got this issue too. Random freeze some view. Ti SDK 7.2.0 . if I use SDK 7.1.0 this issue will resolve.