B4A Library Facebook - Extends FirebaseAuth to support Facebook

Abdou1283

Member
Licensed User
Longtime User
V2.00 released. Requires B4A v12.0. Make sure to update the manifest editor code.
An error has occured in the sample project

B4X:
The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
 

Attachments

  • 111.png
    101.9 KB · Views: 196
  • 112.png
    54.7 KB · Views: 191

Abdou1283

Member
Licensed User
Longtime User
Please post logs and code as text.
Error occured on line 13 in starter service for both
facebook.initialize and facebook.initialize2("fb")


B4X:
Copying updated assets files (5)
*** Service (starter) Create ***
Error occurred on line: 13 (Starter)
The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
    at com.facebook.internal.Validate.sdkInitialized(Validate.kt:129)
    at com.facebook.login.LoginManager.<init>(LoginManager.kt:1398)
    at com.facebook.login.LoginManager$Companion.getInstance(LoginManager.kt:1319)
    at com.facebook.login.LoginManager.getInstance(Unknown Source:2)
    at anywheresoftware.b4x.objects.FacebookSdkWrapper.Initialize2(FacebookSdkWrapper.java:91)
    at chouaibi.dev.kids.puzzle.starter._service_create(starter.java:181)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at chouaibi.dev.kids.puzzle.starter.onCreate(starter.java:56)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4661)
    at android.app.ActivityThread.access$1700(ActivityThread.java:301)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2196)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8653)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
** Service (starter) Start **

this is my manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>
<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.

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)



'************ Facebook Login ****************
CreateResource(values, facebook.xml, <resources>
    <string name="facebook_app_id">****************</string>
   </resources>)
 
AddApplicationText(
    <provider
            android:name="com.facebook.internal.FacebookInitProvider"
            android:authorities="${applicationId}.FacebookInitProvider"
            android:exported="false" />

        <receiver
            android:name="com.facebook.CurrentAccessTokenExpirationBroadcastReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.facebook.sdk.ACTION_CURRENT_ACCESS_TOKEN_CHANGED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.facebook.AuthenticationTokenManager$CurrentAuthenticationTokenChangedBroadcastReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.facebook.sdk.ACTION_CURRENT_AUTHENTICATION_TOKEN_CHANGED" />
            </intent-filter>
        </receiver>
      
         <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:theme="@style/com_facebook_activity_theme" />
        <activity android:name="com.facebook.CustomTabMainActivity" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true"
             >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="cct.${applicationId}"
                    android:scheme="fbconnect" />
            </intent-filter>
        </activity>
)

'************ Facebook Login (end) **********
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…