【发布时间】:2017-05-06 04:17:35
【问题描述】:
我的应用程序使用 FireBaserealtime 数据库和存储。现在我对推送通知 FCM 的部分感到震惊。请帮助任何人怎么做。无论如何,没有打开 Firebase 控制台并向设备发送通知?或者请帮我发送通过编码通知。
【问题讨论】:
标签: android firebase-realtime-database
我的应用程序使用 FireBaserealtime 数据库和存储。现在我对推送通知 FCM 的部分感到震惊。请帮助任何人怎么做。无论如何,没有打开 Firebase 控制台并向设备发送通知?或者请帮我发送通过编码通知。
【问题讨论】:
标签: android firebase-realtime-database
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 应用kill时不会收到通知,因此您需要注册接收器才能获得通知
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>
【讨论】: