使用Realtime Firebase数据库进行FCM消息传递

时间:2017-05-06 04:17:35

标签: android firebase-realtime-database

我的应用程序使用FireBaserealtime数据库和storage.Now我在推送通知FCM.Tlease帮助任何人如何做的部分。我还有没有打开firebase控制台并向设备发送通知?或者请帮我发送通过编码通知。

1 个答案:

答案 0 :(得分:0)

You can use Advance Rest client to send a notification to the device.
Use the link to add extension to chrome

https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo     enter image description here     当app kill时,通知将不会被接收,因此您需要注册Receiver以获取通知

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class OnBootBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent)
    {
    Intent i = new Intent("com.android.pushnotify.MyFirebaseMessagingService");
        i.setClass(context, MyFirebaseMessagingService.class);
        context.startService(i);
    }
}

add inside Manifest.xml(Application tag)

 <receiver android:name="com.androidbash.androidbashfirebasepushnotify.OnBootBroadcastReceiver">
            <intent-filter >
                <action android:name="android.intent.action.BOOT_COMPLETED" />

                <category android:name="android.intent.category.HOME" />
            </intent-filter>
 </receiver>