Like to confirm if we can set android:exported="false"
for instance id service and messaging service.
I tested by keeping android:exported="false"
and notifications are working fine.
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
Firebase Cloud Messaging (FCM) is a cross-platform messaging solution which reliably sends the message at no cost. It is formally known as Google Cloud Messaging, which is used for Android, iOS, and web applications.
Reliability & Platform SupportIn 2022, Firebase Cloud Messaging and the Firebase Notification Composer experienced many major issues, with an average resolution time of 13 days. For almost 25% of the year, Firebase was having at least one major issue. Cloud Messaging issues history for 2022, YTD as of September 2022.
Step 1, Go to the Firebase console. Under Engage, go to Cloud Messaging. We can use this tool to send out notifications to a specific group, device, or topic. Click on “Send your first message” and enter a title and text for the notification.
Make sure the app is in the background on the device. In the Firebase console, open the Messaging page. If this is your first message, select Create your first campaign. Select Firebase Notification messages and select Create.
The firebase-messaging library exports an unspecialized FirebaseMessagingService
of its own with low priority (-500). You can see it in your merged AndroidManifest.xml. This service can handle the push messages that carry notifications, like the ones you can send through the Firebase console.
If your specialized service class isn't exported, then the system will route messages from the Google services package to this unspecialized service, and notifications will work fine.
But that means you wouldn't be able to, for example, perform other actions when receiving a message or process custom data payloads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With