Copy link to clipboard
Copied
Environment:
AIR SDK 29
Android API 15+
Description:
I'm working on Adobe AIR android application and implementing push notifications with FCM through Native extensions. I have setup project on Firebase console and tested with native app, its working fine.
With Adobe AIR app, I'm calling ANE for FirebaseApp initialize manually passing applicationId, api key, database url, storage bucket, projectId and gcmSenderId which I received from google-services.json file. FirebaseApp gets initialized without any error.
I have mentioned FirebaseMessagingService, FirebaseInstanceIdReceiver, FirebaseInstanceIdService in manifest file.
<service android:name="{MY_PACKAGE_NAME}.FCMMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name="com.google.firebase.messaging.FirebaseMessagingService"
android:exported="true">
<intent-filter
android:priority="-500">
<action
android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:permission="com.google.android.c2dm.permission.SEND"
android:exported="true">
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE" />
<category
android:name="{MY_PACKAGE_NAME}" />
</intent-filter>
</receiver>
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter
android:priority="-500">
<action
android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
But FirebaseInstanceId.getInstance is null and it doesn't call onNewToken method of FirebaseMessagingService class.
Please let me know if anyone faced similar issue or if I'm doing something wrong.
If more information required don't hesitate to ask.
" I'm calling ANE for FirebaseApp initialize manually passing applicationId..."
In theory this should work but it doesn't - you will get unexpected behaviour. The ability is there but Firebase tries to find the values as a resource and confuses itself - known problem.
You should package a "values.xml" with your ane and set the values from the json file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">FirebaseANE</string>
<string name="default_web_client_id" translatable="
...Copy link to clipboard
Copied
" I'm calling ANE for FirebaseApp initialize manually passing applicationId..."
In theory this should work but it doesn't - you will get unexpected behaviour. The ability is there but Firebase tries to find the values as a resource and confuses itself - known problem.
You should package a "values.xml" with your ane and set the values from the json file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">FirebaseANE</string>
<string name="default_web_client_id" translatable="false">[JSON client_id]</string>
<string name="firebase_database_url" translatable="false">[JSON firebase_url]</string>
<string name="gcm_defaultSenderId" translatable="false">[JSON project_number]</string>
<string name="google_api_key" translatable="false">[JSON current_key]</string>
<string name="google_app_id" translatable="false">[JSON mobilesdk_app_id]</string>
<string name="google_crash_reporting_api_key" translatable="false">[JSON current_key]</string>
<string name="google_storage_bucket" translatable="false">[JSON storage_bucket]</string>
<string name="project_id" translatable="false">[JSON project_id]</string>
<string name="ga_trackingId" translatable="false">[JSON tracking_id]</string>
</resources>
You may also not be including the com.google.android.c2dm.permission.RECEIVE permission?
Otherwise it's hard to tell what else you may be doing wrong. Logcat is the best tool to see what's happening.
I have written an open source FirebaseANE suite which includes Messaging if you want to take a look.
Messaging Configuring the ANE · tuarua/Firebase-ANE Wiki · GitHub
GitHub - tuarua/Firebase-ANE: Firebase Adobe Air Native Extension for iOS 9.0+ and Android 19+.
Copy link to clipboard
Copied
Thanks for the response. I'm including all the permissions properly. So I don't think thats the issue. But I'm not mentioning ContentProvider in app xml file.
I'm checking the Firebase ANE code and will try packaging ANE with values.xml.