回答
关于显示toast.write的活动方法。
registerReceiver(new MyReceiver(),new IntentFilter("MyReceiver"));
然后创建一个MyReceiver BroadCastReceiver作为该Activity的内部类。 as。
public class MyReceiver extends BroadCastReceiver{
public void onReceive(Context context, Intent intent){
Toast.makeText(context,intent.getStringExtra("from")+" "+intent.getStringExtra("message"),Toast.LENGTH_SHORT).show();
}
}
///finally you have to write the following codes on the
onMessageReceived
Intent intents=new Intent();
intents.setAction("MyReceiver");
intents.putExtra("message",message.getData().get("message"));
intents.putExtra("from",message.getData().get("from"));
getBaseContext().sendBroadcast(intents);
谢谢!!!!!你解决了我的问题... –
非常感谢你编辑答案,代码没有很好的安排 – mcamocci
Firebase云消息传递Android Quickstart app演示了如何注册用于通知的Android应用程序并处理收到的消息。 InstanceID允许轻松注册,而FirebaseMessagingService和FirebaseInstanceIDService可在客户端上启用令牌刷新和消息处理。
但是该示例没有演示如何在活动范围上处理FCM。 – wonsuc
- 1. firebase云消息传递(使用应用程序客户端)
- 2. Firebase云消息传递iOS应用程序,getFrom Android等效?
- 3. 如何在服务器端实现firebase云消息传递?
- 4. 如何在webapp中实现firebase云消息传递?
- 5. Firebase云消息传递仅发送Web应用程序中的消息
- 6. firebase云消息传递:setBackgroundMessageHandler未调用
- 7. 使用Firebase云消息传递在Xamarin跨平台上聊天应用程序
- 8. 如何将Firebase云消息传递添加到Xamarin.Forms应用程序?
- 9. Firebase通知 - Firebase云消息传递
- 10. 如何在应用关闭时使用Firebase云消息传递通知
- 11. 在我的android应用中实现Google云消息传递
- 12. Firebase云消息传递 - 向所有用户发送消息
- 13. 如何从Google App Engine应用程序发送Firebase云消息
- 14. 如何在Android应用程序中初始化Firebase云消息
- 15. Firebase云消息传递发送click_action
- 16. Firebase云消息传递的主题?
- 17. C中的Firebase云消息传递#
- 18. Android,FireBase云消息传递,(FCM)
- 19. Firebase云消息传递 - 一组设备
- 20. Firebase云消息传递:最佳做法
- 21. Firebase云消息传递错误
- 22. Xcode 8和Firebase云消息传递
- 23. Firebase通知和云消息传递
- 24. Firebase云消息传递重复通知
- 25. Firebase云消息传递如何取消订阅主题
- 26. 虽然我没有使用Firebase云消息传递,但缺少云消息传递权限
- 27. 无法在mysql数据库中使用firebase云消息传递
- 28. 无法使用php触发Firebase云消息传递
- 29. 使用AWS SNS的Firebase云消息传递
- 30. Google云消息传递 - Android应用程序
你应该在我的答案为它创建 –
服务只需复制并粘贴服务类和包括它,它会在后台运行 –
你知道,火力是REALT实时数据库,对不对?只要您的应用程序的操作系统连接到数据库,每一次更新(取决于您的实施)都会立即收到。 –