Android 如何捕获查找com.facebook.katana.provider.PlatformProvider的提供商信息失败错误

Android 如何捕获查找com.facebook.katana.provider.PlatformProvider的提供商信息失败错误,android,facebook,exception,try-catch,facebook-sdk-3.1,Android,Facebook,Exception,Try Catch,Facebook Sdk 3.1,有人能告诉我在哪里设置一个try/catch来捕捉这个吗 02-10 22:54:35.701: E/ActivityThread(787): Failed to find provider info for com.facebook.katana.provider.PlatformProvider 我已经知道这是因为我没有在手机上安装facebook应用程序 当这个例外被抛出时,我想干杯 这是行不通的 shareButton.setOnClickListener(new OnClickLis

有人能告诉我在哪里设置一个try/catch来捕捉这个吗

02-10 22:54:35.701: E/ActivityThread(787): Failed to find provider info for com.facebook.katana.provider.PlatformProvider
我已经知道这是因为我没有在手机上安装facebook应用程序

当这个例外被抛出时,我想干杯 这是行不通的

shareButton.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {

            // TODO Auto-generated method stub
            try{
            FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(Archivo.this)
            .setLink(pagina)
            .setName(nombre)
            .setPicture(photo)
            .setDescription(brief)
            .build();
            uiHelper.trackPendingDialogCall(shareDialog.present());
            }
            catch(FacebookDialogException ex){
                int duration = Toast.LENGTH_SHORT;
            CharSequence FacebookDialogError="Instale y actualize su version de Facebook";
            Toast toast = Toast.makeText(activity,FacebookDialogError , duration);
            toast.show();

            }
        }
    });
我在facebookdialog收到异常但仍不工作的地方设置了相同的toast

 public FacebookDialog build() {
        validate();

        Bundle extras = new Bundle();
        putExtra(extras, NativeProtocol.EXTRA_APPLICATION_ID, applicationId);
        putExtra(extras, NativeProtocol.EXTRA_APPLICATION_NAME, applicationName);

        Intent intent = handleBuild(extras);
        if (intent == null) {
            int duration = Toast.LENGTH_SHORT;
            CharSequence FacebookDialogError="Instale y aCtualize su version de Facebook";
            Toast toast = Toast.makeText(activity,FacebookDialogError , duration);
            toast.show();
            throw new FacebookException("Unable to create Intent; this likely means the Facebook app is not installed.");
        }
        appCall.setRequestIntent(intent);

        return new FacebookDialog(activity, fragment, appCall, getOnPresentCallback());
    }

我该怎么做才能为这一例外干杯呢?

如果回答我自己的问题为时已晚,我很抱歉,但我将在这个问题出现的地方更新应用程序。 由于这个问题仍然被关注,我将发布一个疑难解答

如果找不到Facebook应用程序,这是一个后备方案

    private void publishFeedDialog(String Link,String Name,String Photo,String Descripcion) {

    Bundle params = new Bundle();
    params.putString("name", Name);
    params.putString("caption",Caption);
    params.putString("description",Descripcion);
    params.putString("link", Link);
    params.putString("picture",Photo);

    WebDialog feedDialog = (
            new WebDialog.FeedDialogBuilder(sEstablecimiento.this,
                    Session.getActiveSession(),
                    params))
            .setOnCompleteListener(new OnCompleteListener() {

                @Override
                public void onComplete(Bundle values,
                                       FacebookException error) {
                    if (error == null) {
                        final String postId = values.getString("post_id");
                        if (postId != null) {
                            Toast.makeText(sEstablecimiento.this,
                                    "Posted story, id: "+postId,
                                    Toast.LENGTH_SHORT).show();
                        } else {
                            // User clicked the Cancel button
                            Toast.makeText(sEstablecimiento.this.getApplicationContext(),
                                    "Publish cancelled",
                                    Toast.LENGTH_SHORT).show();
                        }
                    } else if (error instanceof FacebookOperationCanceledException) {
                        // User clicked the "x" button
                        Toast.makeText(sEstablecimiento.this.getApplicationContext(),
                                "Publish cancelled",
                                Toast.LENGTH_SHORT).show();
                    } else {
                        // Generic, ex: network error
                        Toast.makeText(sEstablecimiento.this.getApplicationContext(),
                                "Error posting story",
                                Toast.LENGTH_SHORT).show();
                    }
                }

            })
            .build();
    feedDialog.show();
}
并使用布尔值测试ShareDialog是否可以构建

if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
                                FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {

                            FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(myActivity.this)
                                    .setLink("page")
                                    .setName("name")
                                    .setPicture("photo")
                                    .setDescription("description")
                                    .build();
                            uiHelper.trackPendingDialogCall(shareDialog.present());

                        } else {
                            publishFeedDialog("page","name","photo","description");
                        }
我希望它能对某人有用。
感谢您的同情,请原谅我对这个问题的漠不关心。

他们可能没有抛出异常,因为FB SDK在没有应用程序的情况下工作。您使用此信息的目的是什么?为了让舒尔成为安装了facebook应用程序的用户,但鉴于此,如果没有安装facebook应用程序,我使用了一个用于web的回退共享对话框。现在,我正在开发的应用程序在这两种情况下都能正常工作。我稍后会发布解决方案。。。