Use One Signal to add push notifications. There's no need to do anything on the Apple Member Center.
- Use this to download a .p12 file
- Add a new app using the same .p12 for developer and production
- Note your App ID and REST API Key from App Settings > Keys & IDs
-
Add the plugin
cordova plugin add onesignal-cordova-plugin
-
Add this script and call...
App.push.init(appID, callback)
callback
recieves a user id (UID). Store it on a server if you want to push directly to this user.
curl -X POST -H "Authorization: Basic [---REST API Key---]" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
"app_id": [---App ID---],
"contents": {"en": "Hello there!"},
"include_player_ids": [ [---UID---] ]
}' "https://onesignal.com/api/v1/notifications"
var appID = [---App ID---];
var restKey = [---REST API Key---];
var user = [---UID---];
var message = "Hello World";
var settings = {
"async": true,
"crossDomain": true,
"url": "https://onesignal.com/api/v1/notifications",
"method": "POST",
"headers": {
"authorization": "Basic "+restKey,
"content-type": "application/json",
"cache-control": "no-cache",
},
"processData": false,
"data": "{\n \"app_id\": \""+appID+"\",\n \"contents\": {\"en\": \""+message+"\"},\n \"include_player_ids\": [\""+user+"\"]\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
More at https://documentation.onesignal.com/docs/server-api-overview