[AC-2467] ACS push notification with registered app not receiving
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2014-02-14T06:09:09.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Jayme Fishman |
Assignee | Marco Cota |
Created | 2014-01-27T11:27:38.000+0000 |
Updated | 2016-03-08T07:41:31.000+0000 |
Description
I have uploaded my iOS keys from the keychain to the ACS manager (dev and prod). They keys are for a push enabled application. I used the code in the ACS example to receive push notifications. I re-installed the app I am writing with the new provision profile. I don't get an error on startup (which I did before I started using the new profile). I can see the application in the iOS settings as an app that can receive push notifications. I then went to test sending a push notice several times from dev and then once eventually from prod after dev did not work and none of them went through - but I am not getting any errors. I should also mention that the documentation in the Titanium Push Notification Guide is a bit unclear as to the necessity of creating a user and/or registering to a channel as well as the use of tokens. The documentation makes most of those steps seem like optional alternatives to a general push registration. That said, I did create a user but am not logging that user in because the example was unclear and I would prefer not to have every user login if avoidable.
The code I have in app.js to register for push notices is as follows (am I missing something):
Ti.Network.registerForPushNotifications({
// Specifies which notifications to receive
types: [
Ti.Network.NOTIFICATION_TYPE_BADGE,
Ti.Network.NOTIFICATION_TYPE_ALERT,
Ti.Network.NOTIFICATION_TYPE_SOUND
],
success: deviceTokenSuccess,
error: deviceTokenError,
callback: receivePush
});
// Process incoming push notifications
function receivePush(e) {
alert('Received push: ' + JSON.stringify(e));
}
// Save the device token for subsequent API calls
function deviceTokenSuccess(e) {
deviceToken = e.deviceToken;
}
function deviceTokenError(e) {
alert('Failed to register for push notifications! ' + e.error);
}
Just thought I would bump this as it is a blocking issue for me. Please let me know if I am missing something or if this is a bug. Thanks.
Just checking in again. Please let me know if this is an ACS issue.
The code you are providing is only intended to enable the device and the app to receive Push Notifications, either from ACS or a third party service, in order to use the ACS as you mention you will need to create a user and subscribe to a channel. Related wiki: http://docs.appcelerator.com/titanium/3.0/#!/guide/Push_Notifications API: http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Cloud.PushNotifications This is the sample code of how to implement and subscribe to the ACS push notification service.
That is very helpful. The piece that is still unclear is how does one programmatically create a user? I can see how to do it from the ACS panel but that would not be practical OR can you share a single "user" across multiple devices?
Please take a look at the following documentation that describes how to create a user programatically. http://docs.appcelerator.com/cloud/latest/#!/api/Users-method-create
I got this working now - you can close the ticket if you want.
Closing this ticket based on reporter's latest comment.