In my application I am implementing the Push Notification Service.
I have a Content Provider server, which contains some products in it.
I have generated the SSL Cli
PushMeBaby is frozen when I test iOS10 in Xcode8. Try NWPusher, https://github.com/noodlewerk/NWPusher. A friendly and simple tool with GUI.
Very cool guide is posted here: Programming Apple Push Notification Services
And an application named PushMeBaby Mac Os App which you can download and use for sending push-notifications to your devices from a Mac.
APNS will send the push notification to your device as soon as your device will become available. If I've not mistaken your device pings APNS every minute.
You should try the the branch of PushMeBaby, it worked for me.
I created a small script to do that
import json
import jwt
import time
from hyper import HTTPConnection
ALGORITHM = 'ES256'
# fill these items
APNS_KEY_ID = ''
TEAM_ID = ''
BUNDLE_ID = ''
# put path to p8 file
APNS_AUTH_KEY = ''
# put device token id (of the notification receiver)
REGISTRATION_ID = ''
# let's do the magic :)
f = open(APNS_AUTH_KEY)
secret = f.read()
token = jwt.encode(
{
'iss': TEAM_ID,
'iat': time.time()
},
secret,
algorithm= ALGORITHM,
headers={
'alg': ALGORITHM,
'kid': APNS_KEY_ID,
}
)
path = '/3/device/{0}'.format(REGISTRATION_ID)
equest_headers = {
'apns-expiration': '0',
'apns-priority': '10',
'apns-topic': BUNDLE_ID,
'authorization': 'bearer {0}'.format(token.decode('ascii'))
}
connection = HTTPConnection('api.development.push.apple.com:443')
# put the payload you need
payload_data = {
'aps': {
'content-available': '1',
},
}
payload = json.dumps(payload_data).encode('utf-8')
connection.request(
'POST',
path,
payload,
headers=request_headers
)
resp = connection.get_response()
print(resp.status)
print(resp.read())
https://gist.github.com/IvanivOleg/7ba4072128b2c05a068a6826be68a3d3
You can use APNS tester,its a very good tool for test APNS from Mac Machine link to download this software. 2 things you need to provide to test push notification
1.APNS certificate (.cer file) 2.Device token of user's iOS device
I tried all 3 of the above suggestions with no success. In case someone else is ends up here looking for a solution to this, I found this and it works great:
Pusher https://github.com/noodlewerk/NWPusher