Should I use a different certificate for the APNS HTTP2 API? - apple-push-notifications

Recently, I want to change my codes of pushing notifications to apple from basing on old binary API to new http2 API. The question is that should I use a different certificate for this http2 API when I connect to apple ? Because when I send a notification to apple with a valid token(the token is valid when I send notifications with old API) using http2 API, it returns "BadDeviceToken". So I'm wondering whether the token is really bad or the certificate that I use is not qualified .

We were also trying to break our heads with such an issue where we were trying to send push to production device tokens using the HTTP/2 API but were getting {"reason":"BadDeviceToken"} as the response and it was a clear mistake from our side, we were using the same code that we were using for test push notifications on dev environment to send push notifications on production, which was sending push to
https://api.development.push.apple.com/3/device/
rather for production it should be
https://api.push.apple.com/3/device
Hope it helps somebody but one issue with the new API is the distribution SSL certificate works for both the sandbox and production, not the other way round so be careful.

You can still use your old certificate with the new HTTP/2 API.
The BadDeviceToken is most commonly because you are trying to push through their production gateway wth a development token or vice versa.
Tokens are only valid for either development or production, and this is determined by the provisioning profile of your app.

Related

Push notification from local API in xamarin forms

I am having an API locally hosted in one of the servers (LAN). What I am looking to understand if it is feasible to enable push notification from the server in case of a record entry. Every time a post request is made to the local server, Is it possible to push a notification to a certain mobile device? Please note, I am not considering push notification from web services such as google, Azure, Firebase etc.
It is feasible.
As Sushi said, you can use WebSockets or other Sockets to keep connect between Apps and Server. When client connected to your server, server will record which app is connecting.
By the way, you can custom notification's url between server and app.Use some special characters to distinguish between your various parameters, such as &/[ ]. You are free to set the header and body style of the message. Also, when your message needs to be encrypted, some encryption methods can be used.
Here is a similar discussion about Building an Android notification server can be refer .

Is it still possible to use unsecured websockets with Firebase?

I am trying to integrate Firebase with my Cocos2d-JS application. Unfortunately, Cocos2d-JS does not support secure websockets, so I am trying to connect to Firebase using the WS protocol. Firebase is returning a 404 when I try this. Is it possible to enable the unsecured websocket endpoint with Firebase? It would be great to use this while developing, and then work on getting secure websockets working once the game is finished. The game is just for a uni project, so security is not a major concern.
Per #Kato's comment, this is not currently possible. You must use SSL.
If this is something you need, please make a Cocos2d-JS feature request or a Firebase feature request.

Send Push Notifications Through Proxy (APNs and GCM)

I have built both ios and android apps which will receive push notifications. The problems are NOT from device side but from server side.
Because our company's internal server must connect to external network through Proxy, when users send notifications to mobile devices, the server which handles sending notification request must send request to proxy server then proxy server forwards request to APNs and GCM.
I have no idea about how to send push notification requests through proxy. I have studies in this case for several days, but no solutions have been found.
I saw some guys said APNs does not allow connections coming from Proxy Server. Only direct connection is accepted. Is that true? Is there any official docs mentioned it?
Is there anyone able to help me?
I wanna know how to send push notification through proxy for ios and android.
If you are using Java.You can use javaApns enter link description here for ios. I my self have problem right now to get GCM to send through proxy on my Server local it works. If you can you can configure the application server to send through proxy.

Can you not just send one push notification to Apple's Newsstand?

We are developing a Newsstand app, and are currently working on the push notification to let users know a new issue has arrived. From the ambiguous Apple documentation it looks like we will need to send a separate push notification for each user that downloaded the app; each notification should contain a unique device token for each app instance.
The section titled Trust Components seems to imply that you can use the device token or the certificates to authenticate your push notification, but it also implies you need both.
Is it correct that we will need to send out a separate push notification for each installed instance? Can we really not send one push notification and have Apple notify all the users of the app that a new issue has arrived?
Short answer is YES the statement you made is correct.
You have to send out push notification to each device token which must be stored in your server (provider). The preferred way to send multiple notification is to not make multiple connections but reuse one to send multiple notifications. Below is the paragraph from Apple Doc
You should also retain connections with APNs across multiple
notifications. APNs may consider connections that are rapidly and
repeatedly established and torn down as a denial-of-service attack.
Upon error, APNs closes the connection on which the error occurred

APNS spoof/fake

I want to have a standalone network (no internet access) for testing. Is there any way to spoof the APNS servers to test notifications and MDM. Is there a way to create your own APNS server.
Sure. The APNS protocol is defined in Apple's documentation here: The Binary Interface and Notification Formats. Basically, it's just an SSL server that speaks a simple binary protocol. We have implemented a mock push server and feedback server for our internal testing.

Resources