سؤال

From my research the GCM require the data below

APP API KEY
Server KEY
Project Number

The problem is , there are two app , and I would like both of them using the same GCM service, that means receive the same message, using the same database to store the registeration ID. However, I find a conflict like this:

if using the different google project , the server API key is not match with the project ID (it seems the Project number should be align with the server API key)

However, it is also obvious that if I use the same project, the APP API KEY is not the same.

هل كانت مفيدة؟

المحلول

What you are asking for is not possible. Even if both apps use the same Google project, the same project number and the same API key (which is possible), each app will register separately to GCM and receive a different registration ID. You would have to send the message to both registration IDs in order for both apps on the same device to receive it.

It doesn't make sense, though, to have two apps on the same device receiving the same message. If your requirement is to have two versions of the same app (for example a free version and a paid version), and each device would have only one of the two installed, your server doesn't need to know about the difference between the two apps if you use the same project number and API key (since the same API key would be used to send messages to both apps).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top