问题描述
默认FirebaseApp在此过程中未初始化.确保首先调用FirebaseApp.initializeApp(Context).
Default FirebaseApp is not initialized in this process. Make sure to call FirebaseApp.initializeApp(Context) first.
我尝试了很多事情,但无法在设备中获取通知.
i have tried with many things but i am not able to Get notifications in devices.
我也尝试了以下方法.
在属性"窗格中,设置构建操作",然后在解决方案资源管理器"窗口中选择google-services.json.
In the Properties pane, set the Build Action Select google-services.json in the Solution Explorer window.
在属性"窗格中,将生成操作"设置为GoogleServicesJson(如果未显示GoogleServicesJson生成操作,请保存并关闭解决方案,然后重新打开它):至GoogleServicesJson
In the Properties pane, set the Build Action to GoogleServicesJson (if the GoogleServicesJson build action is not shown, save and close the Solution, then reopen it):to GoogleServicesJson
之前,通知是有效的,但是在我将xamarin表单更新为2.5.0.280555和Xamarin.Firebase.Messaging.42.1021.1之后,它停止了工作.
Notification was working before, but after I update the xamarin forms to 2.5.0.280555 and Xamarin.Firebase.Messaging.42.1021.1, it stopped working .
推荐答案
请确保:
-
AndroidManifest.xml
中的软件包名称与google-services.json
中的软件包名称相同 -
google-services.json
构建操作设置为GoogleServicesJson
- 第2步后,重新启动您的IDE&清洁重建
- 在
LoadApplication(..)
之前在
MainActivity.OnCreate
中明确调用FirebaseApp.InitializeApp(Application.Context);
- Package name in
AndroidManifest.xml
is identical to one in thegoogle-services.json
google-services.json
build action is set toGoogleServicesJson
- After step 2 restart your IDE & clean & rebuild
- Explicitly call
FirebaseApp.InitializeApp(Application.Context);
inMainActivity.OnCreate
just before theLoadApplication(..)
这篇关于默认FirebaseApp在此过程中未初始化.确保首先调用FirebaseApp.initializeApp(Context)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!