Pas*_*cal 6 android push-notification firebase xamarin
我想从Github包中实现 GettingStarted 。到目前为止,如果我像教程中那样做所有事情,我会收到错误“定位 S+(版本 31 及更高版本)需要为 android:exported 定义一个显式值,当存在意图过滤器时]”,用于 crc640921eac73192168e.PNMessagingService。这意味着我必须将代码添加到 Manifest.xml 中,并使用导出的属性=true 或 false。但我不知道必须将哪些代码粘贴到 XML 中才能使其正常工作?在另一个用户Stackoverflow的进一步问题中,他得到了设置导出 = false 的答案,但他没有说确切的代码必须是什么,也许这样可以帮助我:D
对于那些仍然遇到这个问题的人(我很难找到答案),实际上这个问题可以通过在标签上添加 Exported = false 轻松解决(它可能在服务、活动等中)
例子:
[Service (Exported=false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
or
[Activity (Exported=false)]
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }]
Run Code Online (Sandbox Code Playgroud)
将其添加到 Android Manifest 中(只需要上面或下面之一)
<service
android:name="crc64620eeeaa876b9f26.MessagingServiceHandler"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
希望这有帮助!莱因哈德·苏尔
将其放入AndroidManifest.xml文件的接收器中。这是这个插件的接收器。您需要将其放入<application>标签内。
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,您可以查看AndroidManifest.xml此插件的示例。