I did the follow
Change the manifest with
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
I used a small software that I did some time ago to test some features than I tested with this test app and I had to recreate the project in Firebase and worked
Than I recreate the SOS software ( new one) in Firebase and I changed the application name ( test app ) to match the SOS app and tested and worked.
In the SOS App I still can not compile, I get this error bellow
I tryed to use the same manifest from the test app but still could not compile
Bellow the manifest from the SOS app
The problem occurs when I try to initialize the Firebasemessaging ( fm.Initialize("fm")
Change the manifest with
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
I used a small software that I did some time ago to test some features than I tested with this test app and I had to recreate the project in Firebase and worked
Than I recreate the SOS software ( new one) in Firebase and I changed the application name ( test app ) to match the SOS app and tested and worked.
In the SOS App I still can not compile, I get this error bellow
B4X:
*** Service (firebasemessaging) Create ***
firebasemessaging_service_create (java line: 790)
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process hsp.sosapp. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.4:240)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.Initialize(FirebaseNotificationsService.java:97)
at hsp.sosapp.firebasemessaging._service_create(firebasemessaging.java:790)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at hsp.sosapp.firebasemessaging.onCreate(firebasemessaging.java:56)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2408)
at android.app.ActivityThread.access$1600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1287)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4950)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
at dalvik.system.NativeStart.main(Native Method)
I tryed to use the same manifest from the test app but still could not compile
Bellow the manifest from the SOS app
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="27"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddPermission(android.permission.CAPTURE_AUDIO_OUTPUT)
AddPermission(android.permission.MODIFY_AUDIO_SETTINGS)
AddPermission(android.permission.RECORD_AUDIO)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
CreateResourceFromFile(Macro, Themes.LightTheme)
'#### NEW MANIFEST FIREBASE FOR B4A V8
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
'CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
'CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
CreateResourceFromFile("google-services", "google-services.json")
SetActivityAttribute(main, android:windowSoftInputMode, adjustPan|stateHidden)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission (android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.WAKE_LOCK)
AddApplicationText(
<provider
android:authorities="${applicationId}.firebaseinitprovider"
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:initOrder="100" />
)
'************ Firebase Base (end) ************
The problem occurs when I try to initialize the Firebasemessaging ( fm.Initialize("fm")
B4X:
Sub Service_Create
fm.Initialize("fm")
Timer_beep.Initialize ( "Timer_Beep", 180000)
Timer_beep.Enabled = False
End Sub