Hi,
today I added support for APNS push notifications to my titanium mobile app. These notifications are sent from my php service and are delivered correctly when the app is running, so all configuration on server side and certificates/provisioning profiles are correct. However, when the app is running in the background the notifications are not received. Also when the app is not running, I don't get a builtin push notification anymore for the app.
Does someone know how to also enable these push notifications when the app is not running or running in background? Since I use APNS, I of course debug on an iPhone.
I use the code below, which works when the app is running:
Ti.Network.registerForPushNotifications({ types: [ Ti.Network.NOTIFICATION_TYPE_BADGE, Ti.Network.NOTIFICATION_TYPE_ALERT, Ti.Network.NOTIFICATION_TYPE_SOUND ], success: deviceTokenSuccess, error: deviceTokenError, callback: receivePush }); function receivePush(e) { var data = e.data; console.log(e.data); if (data.vibrate == 1) Titanium.Media.vibrate(); if (data.sound == 1) { var notificationSound = Ti.Media.createSound({url:Constants.Audio.notificationSound, volume:0.5}); notificationSound.play(); } if (Titanium.App.messageWindow) showMessageTimeout(data.title + "\n\n" + data.message, 3000, Titanium.App.messageWindow); updateWall(true); } // Save the device token for subsequent API calls function deviceTokenSuccess(e) { Ti.API.info('Registered successfully for push notifications with token: ' + e.deviceToken); Titanium.App.PushService = {"deviceToken" : e.deviceToken}; } function deviceTokenError(e) { Ti.API.info('PushNotifications error: ' + e.error); }