我正在使用 nuget 包Xamarin.Firebase.Messaging并Xamarin.GooglePlayServices.Base在我的应用程序中接收推送通知,以前它工作正常,但是当我更新时visual studio 2022 to 17.2.3它停止工作
我尝试了所有这些:
<PackageReference Include="Xamarin.Google.Guava" ExcludeAssets="all"> <Version>27.1.0</Version> </PackageReference>
我之前所做的一切都不起作用
我的接收推送通知的代码:
using System;
using System.Threading.Tasks;
using Android.App;
using Firebase.Messaging;
using Plugin.DeviceInfo;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace MyApp.Droid
{
[Service]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class MyFirebaseMessagingService : FirebaseMessagingService
{
readonly AndroidNotificationManager _androidNotification = new AndroidNotificationManager();
public override void OnMessageReceived(RemoteMessage message)
{
var mensajeData = message.Data;
string title= mensajeData["notiTitle"];
string bodymessage= mensajeData["notiBody"]; …Run Code Online (Sandbox Code Playgroud) push-notification xamarin.android firebase xamarin.forms firebase-cloud-messaging
我找不到服务器密钥,我在 firebase 控制台中设置了一个新项目,在我的项目设置中我启用了 Cloud Messaging API V1,但看不到服务器密钥,我的 Cloud Messaging 显示为已禁用,在哪里可以找到它?谢谢
我正在使用 Expo、EAS Build 创建一个适用于 Android 的 React Native 应用程序。
按照此处的文档,我为我的应用程序设置了通知,包括 Firebase Cloud Messaging。
在我的代码(主要取自文档)中,我使用 UseEffect 在应用程序启动时检查通知权限,如果应用程序没有权限,我会请求权限。
但是,当我在开发服务器上加载应用程序时,会弹出警报,指出“无法获取推送通知的推送令牌!”
为了确保其他一切正常工作,我通过设置在我的设备上手动启用了通知权限。然后,该应用程序运行良好。我正在安排工作的通知。没有问题。
但显然,我不希望用户必须手动进入设置。我希望出现提示。
这是否是开发服务器的问题,一旦部署就不再存在?
任何帮助表示赞赏。谢谢。
以下是我认为来自我的 App.js 的相关代码。我希望用户第一次打开应用程序时会出现提示,要求他们授予通知权限。
import * as Notifications from "expo-notifications";
// other import statements
Notifications.setNotificationHandler({
handleNotification: async () => {
return {
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
};
},
});
// other code
export default function App() {
// other code
const notificationListener = useRef();
const responseListener = useRef();
useEffect(() => {
registerForPushNotificationsAsync().then(token => setExpoPushToken(token));
// This listener …Run Code Online (Sandbox Code Playgroud) permissions reactjs react-native firebase-cloud-messaging expo
我对编程很陌生,所以如果我的问题的答案很简单,请原谅我。
我正在寻找可以跨设备实时处理推送通知的移动(Android + IOS)/网络推送通知工具。通过我的研究,我发现了很多工具/API,但我不知道所有这些工具的优缺点。老实说,我很失落。
在我的研究过程中,我发现了下面的工具列表,但很难知道哪些工具最适合我的需求。
我在这个Benchmark上发现了其中一些感兴趣但有点过时的内容。
同时,我还需要这个工具来触发基于 GPS 数据的推送通知。这意味着当用户进入地理围栏时,他会立即收到推送通知。我不确定上述所有供应商是否可以做到这一点。
我需要的工具应该很容易设置,因为它适用于需要快速推向市场的初创公司。最重要的是,价格和可靠性以及可扩展性也非常重要。
这里有人听说过/使用过这个工具之一并且愿意提供有关它们的反馈吗?如果是这样,我将不胜感激
如果您使用了上面未列出的可以满足我需求的工具,我也很乐意讨论它。
非常感谢,
PS:我将在这个项目中使用 Ruby on Rails 6 和 React Native
伙计们,也许有人正在将 firebase 消息传递与 mac os 应用程序(通知)集成?我尝试在谷歌中搜索,但一无所获。任何人都可以遇到这样的问题可以建议或提供一些来源吗?
我想在我的应用程序中使用推送通知,其他一些事情,比如我手动处理的服务器数据库同步,那么哪个是最好的选择呢?
我也可以在FCM中使用GCM API密钥吗?
FCM对于无限数量的邮件是免费的吗?
android firebase google-cloud-messaging firebase-cloud-messaging
我有一个 SharedPreference: sharedPref.getBoolean("online", false)
如果我收到一条online错误通知,我想阻止它。如果用户离线,通常不会有通知,但我偶尔会收到通知,我希望将其作为备份以防止通知。
通知通过Firebase Cloud Messaging (FCM) 发送,以下是它在我的应用程序中的处理方式:
class CustomApplication : Application() {
val MATCH_CHANNEL_ID = "MATCH_CHANNEL"
companion object {
var database: AppDatabase? = null
}
override fun onCreate() {
super.onCreate()
val settings: FirebaseFirestoreSettings = FirebaseFirestoreSettings.Builder().setPersistenceEnabled(false).build()
FirebaseFirestore.getInstance().firestoreSettings = settings
CustomApplication.database = Room.databaseBuilder(this, AppDatabase::class.java, "AppDatabase").build()
createNotificationChannel()
}
private fun createNotificationChannel(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
val matchChannel = NotificationChannel(MATCH_CHANNEL_ID, "Nearby matches", NotificationManager.IMPORTANCE_HIGH)
matchChannel.description = "Nearby matches"
val manager: NotificationManager = getSystemService(NotificationManager::class.java)
manager.createNotificationChannel(matchChannel)
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果 …