Facebook Alert:
Example App (ID ***************) appears to be creating a negative experience on Facebook in violation of our Platform Policies. If you do not make the changes to get your app into compliance, we will be forced to place a restriction on your app.
My Email Inbox:
In working to create a great Platform experience for everyone, we ask developers to ensure the apps they build comply with our Platform Policies. Your app Example App (AppId: ***************) doesn't comply with the following:
Platform Policy 8.1: Verify that you have integrated Login correctly. Your app shouldn't crash or hang during the testing process.
During Login, your Android app is crashing or hanging excessively, creating a broken experience for people trying to use your app. To make sure this flow runs smoothly, check that you've integrated Facebook Login correctly. We recommend that you test Login on all integrations. If you have not already done so, please:
Dependency:
implementation 'com.facebook.android:facebook-login:[5,6)'
AndroidManifest.xml:
<activity android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
onCreate():
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.act_login);
callbackManager = CallbackManager.Factory.create();
fb_login_button = findViewById(R.id.fb_login_button);
fb_login_button.setReadPermissions(Arrays.asList(EMAIL));
init();
}
Button onClick:
LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "email"));
facebookCallBack();
facebookCallBack() Method:
private void facebookCallBack() {
fb_login_button.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
//AccessToken accessToken = loginResult.getAccessToken();
getUserDetails(loginResult);
}
@Override
public void onCancel() {
Log.print("FB= " + "onCancel");
}
@Override
public void onError(FacebookException exception) {
Log.print("FB= " + "onError" + exception.toString());
}
});
}
getUserDetails(loginResult) Method:
protected void getUserDetails(LoginResult loginResult) {
GraphRequest data_request = GraphRequest.newMeRequest(
loginResult.getAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
JSONObject json_object,
GraphResponse responseg) {
try {
//get my response here
} catch (Exception e) {
e.printStackTrace();
}
}
});
Bundle permission_param = new Bundle();
permission_param.putString("fields", "id, name, email, first_name, last_name");
data_request.setParameters(permission_param);
data_request.executeAsync();
}
I trying to resolve this issue before 2 to 3 months ago. but still my app is restricted by facebook.
Anyone have solution for that please help me immediately.