As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
I am trying to implement push notifications with the Kinvey Titanium SDK for iOS only (currently). I have gone through the console configuration from the iOS guide. The Kinvey push console shows that iOS Configuration is "Active", so I believe everything is configured correctly there.
In the app, I am using the following method to test registration:
Since the user has the `_push` property, my first guess would be there might be something wrong with the push set-up in the console.
Did you follow the steps outlined [here](http://devcenter.kinvey.com/phonegap/guides/push#ConsoleSetUpIOS)? It links to the PhoneGap guide, but the iOS instructions should be the same. Make sure you use the right push certificate, i.e. the production push certificate only works if your app is in the App Store, use the development certificate otherwise.
J
Jack Vargo
said
about 9 years ago
I was able to register my device, but now I am unsure of how to receive the notification? I have implemented the "callback" method of the Titanium.Network.registerForPushNotifications per the instructions you provided, however sending a push from the console is not doing anything. I have verified the registered user has the _push property and it appears to be the correct device ID.
For reference, here is the registerForPushNotifications (where I call the Kinvey registration method in the success callback).
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT,
Titanium.Network.NOTIFICATION_TYPE_SOUND
],
success:function(e)
{
var deviceToken = e.deviceToken;
//Device token is made available to the next method and I am getting a success response from the Kinvey registration
GH.registerDeviceWithPush();
},
error:function(e)
{
alert("Error during registration: "+e.error);
},
callback:function(e)
{
// called when a push notification is received.
alert("Received a push notification\n\nPayload:\n\n"+JSON.stringify(e));
}
});
Thanks,
Jack
M
Mark
said
about 9 years ago
The `deviceId` for push does not equal `Titanium.Platform.id`. You’ll need to obtain an actual device token for push. On Titanium, you’ll have to use the `Ti.Network.registerForPushNotification` method. See [here](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Network-method-registerForPushNotifications) and [here](http://developer.appcelerator.com/question/9511/push-notifications-devicetoken#answer-21671). You can then use the obtained device id to register for push with Kinvey.
( By the way, note that testing push on the iOS simular is not possible, you’ll have to use a real device. )
C
Caroline
said
about 9 years ago
Hey Jack, I tagged this under JS since it's with Titanium.
Jack Vargo
In the app, I am using the following method to test registration:
registerDeviceWithPush: function() {
var request = Titanium.Network.createHTTPClient({
timeout : 10000 /* in milliseconds */
});
request.open('POST', '' + Kinvey.API_ENDPOINT + '/push/my_actual_app_id/register-device');
request.onerror = function(e) {
alert(JSON.stringify(e));
};
request.onload = function(e) {
alert(JSON.stringify(e));
};
request.setRequestHeader('Authorization', 'Kinvey ' + Kinvey.getActiveUser()._kmd.authtoken);
request.setRequestHeader('Content-Type', 'application/json');
request.send({
'platform': 'ios',
'deviceId': Titanium.Platform.id
});
}
I call this method in Kinvey.init() success function, and after verifying Kinvey.getActiveUser exists.
I am getting the following response from both the simulator and on and actual iPhone:
"{"type":"error","source":{"cache":false},"code":500,"error":"HTTP error","success":false}"
Can you help me identify what I'm doing wrong?
Thank you in advance,
Jack