如何收到一条消息,当应用程序在后台? (机器人,团结,GCM)机器人、应用程序、后台、团结

2023-09-06 08:10:53 作者:遇见你用光了所有的运气

我非常有经验的团结和iOS,我可以部署我的应用程序统一到Android。但我不知道原生Android的东西什么。

I'm very experienced on Unity and iOS and I can deploy my Unity app to Android. But I don't know anything about native Android stuff.

我的问题是关于接收GCM消息,并呈现出通知时,Android应用程序是在后台。我实现了它和它的作品完美的,当应用程序在前台,但我的GCM消息监听器没有被触发时,应用程序在后台,我不能显示通知。

My problem is about receiving a GCM message and showing a notification when the android app is in background. I implemented it and it works perfect when the app is in foreground but my GCM message listener isn't being triggered when the app is in background and I can't show the notification.

我使用这个插件用于接收GCM消息: https://github.com/kskkbys/unity-gcm 我用这个用于显示通知: HTTPS://www.assetstore.unity3d。 COM / EN /#!/内容/ 9484

I use this plugin for receiving GCM messages : https://github.com/kskkbys/unity-gcm I use this for showing the notification : https://www.assetstore.unity3d.com/en/#!/content/9484

我试着伸手这些插件的作者,但他们并没有很长一段时间答复...

I tried to reach out the authors of these plugins but they didn't reply for a long time...

推荐答案

我用Android原生插件从资产存储StansAssets解决我的问题。随着他的实现,Android设备显示了当云邮件到达,即使应用程序在后台的通知。轻敲通知打开的应用程序。

I solved my problem by using "Android Native" plugin from StansAssets in asset store. With his implementation, android device shows a notification when the cloud message arrives even if the app is in the background. Tapping on the notification opens up the app.

 
精彩推荐
图片推荐