Facebook Android SDK ShareDialog 不起作用 [英] Facebook Android SDK ShareDialog doesn't work

查看:85
本文介绍了Facebook Android SDK ShareDialog 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Facebook Android SDK 4.0 有一个奇怪的问题.我添加了所有权限,API_KEY 和 Hashkeys 仔细检查了它们是否正常.但是我不能在我的真实设备上使用 ShareDialog,它是 API 15 和 GenyMotion 4.4.4、4.4.2.

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 应用程序.他们正在将我重定向到网络视图.当我在 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 ?

这是我的AndroidManifest.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" />

这是我的应用程序类;

@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 !

抱歉我的英语不好.

推荐答案

尝试在真机上更新你的 facebook 应用,然后把 Log.i() 消息从 facebook api 中获取日志还尝试清空应用程序缓存并重新安装.同时尝试从 facebook SDK 测试此示例应用程序https://github.com/facebook/facebook-android-sdk/tree/master/samples/美味

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

这篇关于Facebook Android SDK ShareDialog 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆