I am developing a Android SDK, which will be used by different customers in their App.One of the functionality in the SDK is to receive push notifications. Now I am in doubt that should i embed my own Notification Infrastructure (GCM sender Id,GCM Receiver,etc ) or should i ask Customer's App to do it. If i do it , then all my customers will be using my SDK GCM sender ID, apart from their own Sender ID for push Notifications(So their will be multiple senders in the same app - which i guess is OK to do as per Google).Is their any recommended approach or best practice around it?
Asked
Active
Viewed 180 times
0
-
According to this [thread](http://stackoverflow.com/a/14785594/5832311), you should keep your GCM sender ID protected. Your customers can use it and it will count toward your usage of the API. It is similar to the API key for any other service e.g. Google Maps. Also be noted that a `SENDER ID` won't work if you don't know the `SERVER API KEY` and both are needed to be able to send messages via GCM. – abielita Feb 14 '17 at 08:09
1 Answers
0
Ideally you should have a mechanism to receive pushes and register for push token in your SDK. It should be an optional mechanism. If the client app wants to do it on its own it can else your SDK does the job for them. Make sure you don't add the receivers in the SDK's manifest file as multiple receivers cause issues. Adding the receivers should be an integration step. Plus you need to provide a hook for the client to pass in the push payload to your SDK. This would be required in cases where they have their own receiver.

Umang
- 966
- 2
- 7
- 17
-
But the concern here is that i want to have one dedicated mechanism for my SDK . Consumer of this SDK will have its own mechanism to do so.So there will be one receiver in the sdk's manifest and other one in the app's manifest. – Jason1 Mar 18 '17 at 14:34
-
As mentioned above, you should not have multiple receivers in the app. Adding your manifest's receiver should be an integration step. Not a default config. The SDK should provide hooks using which the app can pass the payload/token to your SDK – Umang Mar 20 '17 at 06:03