Has anybody been faced with problems regarding fb events? I have an app on Android, which is published in Google Play. Recently I upgraded it and then I found that my app had stopped send any events to Analytics. My changes wasn't associated with Facebook SDK. I just have changed some code concerning logics of working of some buttons.
Then I tried to create a new test app and checked if it sent events to Analytics. It has worked at first, but in a few minutes there was the same problem. The next day was the same.. I didn't see the any events in analytics. I've checked steps of integration SDK in the app, everything is correct.
Sorry if my English isn't good!
There are some errors in the logs when launching the app:
11556-11580/com.pattern.eventstest E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '147657836189003' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}
But, if I right understand, it's due to the apps with fb authorization button, but I don't use it in my app.
In gradle I've tried to implement 'com.facebook.android:facebook-android-sdk:4.36.0'
and also 'com.facebook.android:facebook-android-sdk:[4,5)'
,the both not working.
Anybody have an idea what is happening?
gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.pattern.eventstest"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'junit:junit:4.12'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.11'
implementation 'org.jsoup:jsoup:1.10.3'
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pattern.eventstest">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>
</manifest>
Strings:
<resources>
<string name="app_name">Events Test</string>
<string name="facebook_app_id">147657836189003</string>
<string name="fb_login_protocol_scheme">fb147657836189003</string>
</resources>
MainActivity:
package com.pattern.eventstest;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.facebook.appevents.AppEventsLogger;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fbAppEvent(this, "onCreate");
}
public static void fbAppEvent(Context context, String name) {
String actName = "app: " + name;
try {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
logger.logEvent(actName);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Please make sure your event name is matching the following regex:
In particular, you have a bug here:
Colon is not allowed. Also allow me to recommend to use an enum to indicate different action(s) for your app, rather string. Take in mind you can send up to 1000 custom event names per App.