I've tried to use FCM with Android Things. I've imported the google json, make the changes in Manifest, subscribe the app to a Topic, but I did not receive a push message. The only thing I get is the Pushtoken from the server.
So does anyone successful create an Android Things FCM project?
Thanks!
Here some code snippets:
Manifest
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<uses-library android:name="com.google.android.things" />
<service android:name=".cls_firebase_idservice">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".cls_firebase_message">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
MainActivity
FirebaseMessaging.getInstance().subscribeToTopic("RaspberryPi3");
Message Receiver
public class cls_firebase_message extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
glo.frm_main.i_handler.sendEmptyMessage(1);
Log.d("RP3", "From: " + remoteMessage.getFrom());
}
}