I'm making a POC in which I'm sending a notification from firebase console to the raspberry running android things.
This worked well when the code was on a smartphone, and when I moved it to the raspberry, nothing works anymore. I can see in the raspberry console (in Android Studio) that the notification is somewhat seen by the rpi3, but the onMessageReceived is not triggered...
Here is some code:
My manifest:
<service
android:enabled="true"
android:exported="true"
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
The subscribing:
private void subscribeToPushService() {
FirebaseMessaging.getInstance().subscribeToTopic("news");
Log.d("AndroidBash", "Subscribed");
Toast.makeText(MainActivity.this, "Subscribed", Toast.LENGTH_SHORT).show();
String token = FirebaseInstanceId.getInstance().getToken();
}
The service:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "FirebaseMessageService";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "NOTIF");
}
}
And finally the notification I send with the firebase console, I really don't understand where I messed up, the package name seems ok...
Thx for reading!
Seems DP5 of Android Things still didn't support Firebase Notifications (from Official Overview):
Android Things supports a subset of the Google APIs for Android. The following table breaks down API support in Android Things:
Unavailable APIs:
AdMob
Android Pay
Drive
Firebase App Indexing
Firebase Authentication
Firebase Dynamic Links
Firebase Invites
Play Games
Sign-In