Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can firebase messaging services can be android:exported="false"?

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>
like image 748
Prakash Avatar asked Feb 08 '18 01:02

Prakash


People also ask

What is Firebase messaging service in Android?

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.

Is firebase cloud messaging reliable?

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.

How do I send Firebase notifications to Android?

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.

How do I check my firebase cloud messaging on Android?

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.


1 Answers

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.

like image 140
guest Avatar answered Sep 20 '22 10:09

guest