Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26349] iOS 10: A couple of issues related to remote push-notifications

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2018-09-19T18:27:08.000+0000
Affected Version/sRelease 6.0.0, Release 7.0.0, Release 7.3.0, Release 7.3.1
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeHans Knöchel
Created2018-09-01T10:52:01.000+0000
Updated2018-09-19T18:27:32.000+0000

Description

There are a couple of issues with notifications on iOS right now:

On iOS 10+, if a notification is delivered while the app is opened, the notification is presented in-app and the usual callback is not fired

On iOS 10+, the contents of the "aps" key are not in the top-level of the "data" key that is returned by the callback of the registerForPushNotifications callback

On iOS 10+, the "localnotificationaction" event is triggered, although "remotenoticationaction" should be triggered

On iOS 10+, the "sound" property of queued pushes can lead to a crash because it's not bridged to a consumable JS-type

On all supported iOS versions, if a remote notification action is triggered and the app is closed, the notificationaction is not triggered

On all supported iOS versions, silent pushes are fired to both the registerForPushNotifications callback and silentpush event. it should only be fired to the silentpush event for parity and API clearance.

Comments

  1. Hans Knöchel 2018-09-01

    (PR was reverted to do some more tests) Test-Case: 1. Create a new app suitable for remote push notifications (with it's certs, provisioning profiles, aps-environment etc) 2. Copy the below code in the app.js / index.js 3. Download the app "Pusher" to simulate push messages from your mac 4. Import your .p12 certificate, paste your device-token received from the "success" callback of your push-registration and try around with it (leave out "content-available" to test non-silent-pushes):
       { "aps":{"alert":"Testing.. (30)","badge":1,"sound":"default", "content-available": 1 }}
       
    JS-code:
       var deviceToken = null;
       
       // 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
           });
       });
       
       Ti.App.iOS.addEventListener('silentpush', function(e) {
           Ti.API.info('SILENTPUSH received');
           Ti.API.info(e);
       });
       
       // Process incoming push notifications
       function receivePush(e) {
           Ti.API.info('Remote push received');
           Ti.API.info(e);
       }
       // Save the device token for subsequent API calls
       function deviceTokenSuccess(e) {
           deviceToken = e.deviceToken;
           Ti.API.info('Device-token: ' + deviceToken);
           Ti.API.info('Successfully registered for push notifications!');
       }
       
       function deviceTokenError(e) {
           alert('Failed to register for push notifications! ' + e.error);
       }
       
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       win.addEventListener('open', function() {
           // 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
               ]
           });
       });
       
       win.open();
       
  2. Hans Knöchel 2018-09-19

    Handled via TIMOB-26399

JSON Source