回答
關於顯示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實時數據庫,對不對?只要您的應用程序的操作系統連接到數據庫,每一次更新(取決於您的實施)都會立即收到。 –