Is there a way to properly configure Firebase messaging with Maven without using Gradle?
I've added this dependency to pom.xml
<dependency> <groupId>com.google.firebase</groupId> <artifactId>firebase-messaging</artifactId> <version>9.0.2</version> <type>aar</type> </dependency> And modified my AndroidManifest.xml by copying configs from AndroidManifest.xml file located in firebase AAR. I didn't find the way to filter them during maven buld using filtering resources or replacer plugin like gradle plugin do.
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <permission android:name="<MY_APP_PACKAGE>.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="<MY_APP_PACKAGE>.permission.C2D_MESSAGE" /> <!-- copied from firebase common module to be able to set <MY_APP_PACKAGE> (that is set during compilation with gradle plugin) --> <provider android:authorities="<MY_APP_PACKAGE>.firebaseinitprovider" android:name="com.google.firebase.provider.FirebaseInitProvider" android:exported="false" android:initOrder="99" /> <!-- copied from firebase iid module to be able to set <MY_APP_PACKAGE> (that is set during compilation with gradle plugin) --> <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="<MY_APP_PACKAGE>" /> </intent-filter> </receiver> <service android:name=".service.PushMessageService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <service android:name=".service.GoogleIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> Also, added string resources (that auto set by gradle plugin from config json file)
<string name="google_app_id" translatable="false">...</string> <string name="google_api_key" translatable="false">...</string> <string name="firebase_database_url" translatable="false">...</string> <string name="ga_trackingId" translatable="false">...</string> <string name="gcm_defaultSenderId" translatable="false">...</string> <string name="google_storage_bucket" translatable="false">...</string> After running the app I had these logs
D/FirebaseApp﹕ com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization. D/FirebaseApp﹕ Initialized class com.google.firebase.iid.FirebaseInstanceId. D/FirebaseApp﹕ com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization. D/FirebaseApp﹕ com.google.android.gms.measurement.AppMeasurement is not linked. Skipping initialization. I/FirebaseInitProvider﹕ FirebaseApp initialization successful The docs says Firebase will request new token automatically but I never receive onTokenRefresh callback Is there anything I missed?
P.S: Please don't suggest using Gradle....
Any help is appreciated... Thanks
onTokenRefresh()part: not that this method will only be called when the token is refreshed. If you added the code after the token was generated, it won't get called. To test if this is the case, log the value of ` FirebaseInstanceId.getInstance().getToken()` somewhere to see if your device/app has a token.