androidfacebookfacebook-analytics

Problem with sending events to analytics over Facebook SDK


I using com.facebook.android:facebook-core:5.0.0 When I try send event to analytics like this

val logger = AppEventsLogger.newLogger(context, "my_app_id")  
logger.logEvent("event", Bundle())

But I has error in logs

    E/GraphResponse: {HttpStatus: 404, errorCode: 803, subErrorCode: -1,  
 errorType: OAuthException, errorMessage: (#803) Some of the aliases you  
 requested do not exist: "my_app_id"}

App was setup like in https://developers.facebook.com/quickstarts/?platform=android

Facebook's support don't answer


Solution

  • I fix with two point:

    1: add two activities in manifest .

    <activity android:name="com.facebook.FacebookActivity"
              android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
              android:label="@string/app_name"/>
    
    <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:scheme="@string/fb_login_protocol_scheme"/>
        </intent-filter>
    </activity>  
    

    2: replace manifestPlaceholders in app/build.gradle with

    resValue "string", "facebook_app_id", "$fbAppId"  
    resValue "string", "fb_login_protocol_scheme", "fb$fbAppId"
    

    I don't know why did't work manifestPlaceholders.