How to send notification between two application

两盒软妹~` 提交于 2020-01-07 03:56:09

问题


I want to send push notification from Device "A" with Application "A" to Device "B" with application "B" how I can achieve that?

Any help will be appreciated.

can I use firebase with that?

With parse I can define that with number like :

ParseQuery query = ParseInstallation.getQuery();
query.whereEqualTo("phone", "1234567890");
ParsePush push = new ParsePush();
push.setQuery(query);
push.sendPushInBackground();

how can I achieve that in other cases ?


回答1:


You'd probably have to go with something like this:

  1. Create two separate Firebase Projects for each app with FCM enabled. (Project A and B)
  2. Implement FCM for both Apps and generate tokens for each project to both apps (i.e. App A has tokenA and tokenB, App B has tokenC and tokenD). See my answer here.
  3. Store the tokens to the corresponding servers.

From there, the flow of interaction should be something like:

App A > sends data > Server A // (contains App B's tokenC)
Server A > sends notification > App B // (by using tokenC)

and vice versa:

App B > sends data > Server B // (contains App A's tokenB)
Server B > sends notification > App A // (by using tokenB)

That's pretty much the general idea.

With all that said, "how can I achieve that in other cases?" is too broad of a question.




回答2:


No, because package name will be different for two application. You cannot use same google-services.json file in both application if you are using FCM.




回答3:


First of all Parse no more exists

now coming to your question yes you can send the push from application A to application B

First implement FCM in App B and store the device id on server.

Now you have device id of App B with user id on server.

Now send request to server to send the push from A to B.



来源:https://stackoverflow.com/questions/44410357/how-to-send-notification-between-two-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!