Facebook的Andr​​oid SDK中ShareDialog不起作用不起作用、Andr、Facebook、oid

2023-09-12 05:50:02 作者:不哭不闹不炫耀

我有一个奇怪的问题与Facebook的Andr​​oid SDK 4.0。我添加了所有的权限,API_KEY和HASHKEYS双重检查,他们都OK。但我不能在我这是API 15 GenyMotion 4.4.4,4.4.2实际设备使用ShareDialog。

I have a strange problem with Facebook Android SDK 4.0. I added all permissions,API_KEY and Hashkeys double checked they are OK. But I can't use ShareDialog on my Real Device which is API 15 and GenyMotion 4.4.4, 4.4.2.

当我尝试打开ShareDialog看来没有我的内容。它打开空我真正的设备上。但它完美的GenyMotion 4.2.1,我试图打开GenyMotion 4.4.4和4.4.2而这些仿真器不打开Facebook的应用程序。他们被重定向我的Web视图。当我输入的的WebView我的信息,我可以看到我所有的内容,所以它的工作了。

When I try to open ShareDialog it appears without my content. It opens empty on my real device. But it works perfectly on GenyMotion 4.2.1, I tried to open GenyMotion 4.4.4 and 4.4.2 but these emulators don't open Facebook App. They are redirecting me to web view. When I enter my information on the webview I can see my all content so it's working again.

怎样才可以?我真正的设备不发布任何东西,但GenyMotion 4.2.1不正常工作?这是什么问题?

How can it be ? My Real Device doesn't post anything but GenyMotion 4.2.1 does work fine ? What is the problem ?

这是我的Andr​​oidManifest.xml;

This is my AndroidManifest.xml;

    <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<application
    android:name=".GlobalState"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.vet" >

    <provider android:authorities="com.facebook.app.FacebookContentProvider351533225052233"
        android:name="com.facebook.FacebookContentProvider"
        android:exported="true" />

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/API_KEY" />

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id"/>

<activity android:name="com.facebook.FacebookActivity"
        android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"
        android:label="@string/app_name" />

这是我的应用程序类;

This is my Application class;

@Override
public void onCreate() {
    super.onCreate();

    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    Parse.initialize(this, "KEY", "KEY");

    FacebookSdk.sdkInitialize(getApplicationContext());

}

这是我的MainActivity.class;

This is my MainActivity.class;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    return inflater.inflate(R.layout.fragment_harita, container, false);
}

public void onViewCreated(View view, Bundle savedInstanceState){
    setupMap();
    //showGPSDisableAlert();

    FacebookSdk.sdkInitialize(getActivity().getApplicationContext());
    callbackManager = CallbackManager.Factory.create();
    shareDialog = new ShareDialog(this);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_share) {
if (ShareDialog.canShow(ShareLinkContent.class)) {
                            ShareLinkContent linkContent = new ShareLinkContent.Builder()
                                    .setContentTitle("vet !")
                                    .setContentDescription(
                                            "asd")
                                    .setContentUrl(Uri.parse("https://facebook.com/vet"))
                                    .build();

                            shareDialog.show(linkContent);}

请帮我解决这个问题。谢谢 !

Please help me to solve this problem. Thank you !

对不起,我的英语不好。

Sorry for my bad English.

推荐答案

尝试真正的设备上更新你的Facebook应用程序,然后把Log.i()的消息获得来自Facebook API登录 尝试也清空应用缓存和重新安装。 与此同时尝试测试从Facebook SDK此示例应用程序 的https://github.com/facebook/facebook-android-sdk/tree/master/samples/Scrumptious

Try to update your facebook app on the real device, then put Log.i() message to get log from facebook api Try also to empty the application cache memory and reinstall it. In parallel try to test this sample application from facebook SDK https://github.com/facebook/facebook-android-sdk/tree/master/samples/Scrumptious

 
精彩推荐
图片推荐