我正在使用Firebase控制台向用户发送通知.但是,我想让用户禁用通知.我怎样才能禁用它们?
只有当应用程序位于前台时,我才能通过FirebaseMessagingService处理(和停止)通知.但是,当应用程序处于后台时,我无法停止通知.
我正在尝试在用户点击通知时尝试打开特定活动,当应用在后台时,使用一些额外参数.我正在使用它click_action并且它工作正常,该应用程序打开所需的活动.
现在我需要服务器将一个额外的参数a传递id给此Activity,以便我可以提供与通知相关的所需详细信息.就像电子邮件应用程序一样,当我们点击通知时,会打开该特定电子邮件的详细信息.
我怎样才能做到这一点?
android android-notifications firebase-cloud-messaging firebase-notifications
我实施了Firebase并测试了Firebase通知.当应用程序在前台我没有问题时,我实现了一个扩展FirebaseMessagingService并处理onMessageReceived中的消息和数据的服务
当应用程序处于后台时,我遇到问题,我想发送一个通知,打开一个特定的活动并完成我计划做的事情,而不仅仅是打开应用程序.
我按照Firebase指南中的说明执行了操作,但我无法启动特定活动.
这里的清单:
<activity android:name=".BasicNotificationActivity">
<intent-filter>
<action android:name="OPEN_ACTIVITY_1" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
这里是Firebase控制台.我必须在这些字段中编写什么来打开我的"BasicNotificationActivity"?
android firebase firebase-cloud-messaging firebase-notifications
Xamarin具有这是在解释GCM(谷歌云通讯)的预定义的支持https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/remote_notifications_in_android/
目前谷歌从GCM迁移到FCM(Firebase云消息传递)是否与Xamarin一起使用相同的指令,或者还有其他任何文档用于将FCM与Xamarin集成?
Firebase中提供的所有功能是否都可以在Xamarin App中使用?
xamarin.android firebase xamarin firebase-cloud-messaging firebase-notifications
在我的iOS Swift应用程序中集成Firebase Notification新API时,我遇到了一个奇怪的问题.从Firebase网络平台发送推送通知时遇到一些困难.我的证书没问题,因为我用快速的PHP脚本测试它,以便向我的手机发送测试通知.
在这篇文章中:https://stackoverflow.com/a/37467793/5082848,据说在AppDelegate中添加
func applicationDidBecomeActive(application: UIApplication) {
FIRMessaging.messaging().connectWithCompletion { error in
print(error)
}
}
Run Code Online (Sandbox Code Playgroud)
但是,FIRMessaging未知,而我的podfile正确包含Firebase/Messaging.以下是pod安装后终端返回的内容:
使用Firebase(3.3.0)
使用FirebaseAnalytics(3.2.1)
使用FirebaseInstanceID(1.0.7)
使用GoogleInterchangeUtilities(1.2.1)
使用GoogleSymbolUtilities(1.1.1)
使用GoogleUtilities(1.3.1)
你有什么线索吗?非常感谢
我正在使用Laravel 5.4,我刚开始学习firebase messaging,notification如果有人发送它我想在我的网络浏览器上.
我实施的是,master page我已经导入firebase scripts如下:
资源/视图/布局/ master.blade.php:
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js"></script>
<script type="text/javascript">
firebase.initializeApp({
'messagingSenderId': '1***************2' //i.e.My firebase key
});
const messaging = firebase.messaging();
</script>
{{ HTML::script('firebase-messaging-sw.js')}} // This script file is there in the public (i.e. root) directory
<script type="text/javascript">
messaging.onMessage(function(payload){
console.log('onMessage', payload);
});
</script>
Run Code Online (Sandbox Code Playgroud)
和
火力点的消息,sw.js:
if ('serviceWorker' in navigator) {
console.log("serviceWorker exists");
navigator.serviceWorker.register('/../firebase-messaging-sw.js')
.then((registration) => {
messaging.useServiceWorker(registration);
messaging.requestPermission()
.then(function() {
console.log('requestPermission Notification permission granted.');
return messaging.getToken(); …Run Code Online (Sandbox Code Playgroud) 我写了一个非常简单的Android应用程序来测试firebase推送通知,我收到两次通知.
这是清单服务:
<service
android:name="com.google.firebase.messaging.FirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)
这是应用程序gradle:
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
这是项目级别的gradle:
classpath 'com.google.gms:google-services:3.0.0'
Run Code Online (Sandbox Code Playgroud) android firebase firebase-cloud-messaging firebase-notifications
我在下面的代码中使用FCM进行推送通知,以便在收到通知时播放声音
public void playNotificationSound() {
try {
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(mContext, notification);
r.play();
} catch (Exception e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我正在调用这个OnMessageReceived方法,但声音仅在应用处于前景时播放,而不是在应用处于后台时播放
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.e(TAG, "From: " + remoteMessage.getFrom());
if (remoteMessage == null)
return;
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.e(TAG, "Notification Body: " + remoteMessage.getNotification().getBody());
handleNotification(remoteMessage.getNotification().getBody());
}
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.e(TAG, "Data Payload: " …Run Code Online (Sandbox Code Playgroud) android push-notification android-notifications firebase firebase-notifications
我最近更新了我的firebase消息传递盒,并按照Firebase的快速入门指南执行必要的升级更改.
我添加了新的extension AppDelegate : MessagingDelegate扩展程序,但遇到了一些错误.
firebase ×8
android ×6
ios ×2
appdelegate ×1
javascript ×1
laravel ×1
swift ×1
swift3 ×1
xamarin ×1