GVKun编程网logo

非开发人员帐户几秒钟后,Android Facebook共享对话框消失(facebook处于开发模式)

19

如果您对非开发人员帐户几秒钟后,AndroidFacebook共享对话框消失感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于非开发人员帐户几秒钟后,AndroidFacebo

如果您对非开发人员帐户几秒钟后,Android Facebook共享对话框消失感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于非开发人员帐户几秒钟后,Android Facebook共享对话框消失的详细内容,我们还将为您解答facebook处于开发模式的相关问题,并且为您提供关于Android AlertDialog实现分享对话框/退出对话框/下载对话框、Android Facebook开发人员无法在“ Android Key Hash”的“示例应用程序设置”上“保存更改”、Android facebook登录无法使用已安装的Facebook应用程序、android – Facebook me / feed只能在开发者帐户上发布的有价值信息。

本文目录一览:

非开发人员帐户几秒钟后,Android Facebook共享对话框消失(facebook处于开发模式)

非开发人员帐户几秒钟后,Android Facebook共享对话框消失(facebook处于开发模式)

我已使用以下代码在Android应用程序中添加了Facebook墙发布功能,但是当我尝试发布数据时,共享对话框会显示几秒钟,然后消失.我在FacebookDialog.Callback one rror方法中收到错误消息,显示为“无法为用户生成预览”,而在Logcat中出现异常,显示为“ ApiException:[code] 100 [message]:(#100)应用程序12345不允许创建以下操作:为用户54321键入namespace_asd:xyz:

    OpenGraphObject obj = OpenGraphObject.Factory.createForPost(“abc”);
    obj.setProperty(
            "title",
            “message goes here“);
    obj.setType(“namespace_asd:xyz”);


    List<Bitmap> imageArr = new ArrayList<Bitmap>();
    imageArr.add(bmp1);

    OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
    action.setProperty("abc", obj);
    action.setType(“namespace_asd:xyz”);


    FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action, "abc").setimageAttachmentsForObject("abc", imageArr,
            true).build();

    uiHelper.trackPendingDialogCall(shareDialog.present());

共享仅适用于开发者帐户,不适用于其他帐户.我已经完成了Facebook提交过程中所需权限(即publish_actions)的批准.

另外,我还启用了状态和功能中的常规公共功能检查功能.查看部分.

请帮助….在此先感谢.

解决方法:

感谢Ming Li和所有人的帮助,我获得了开放图对象的批准,现在,非开发人员用户也可以发布Facebook.

Android AlertDialog实现分享对话框/退出对话框/下载对话框

Android AlertDialog实现分享对话框/退出对话框/下载对话框

一.摘要
弹窗通常用于提示用户进行某种操作,比如:点击分享按钮,弹窗分享对话框;双击返回按钮,弹窗退出对话框;下载文件,提示下载对话框等等,分享对话框/退出对话框/下载对话框,都可以直接使用AlertDialog实现,类似的效果如下图:

二.AlertDialog基础知识
AlertDialog无法直接通过new关键字获取对象,调用方法:new AlertDialog.Builder.create()获取AlertDialog对象,这个时候容易让人疑惑的是:如何设置对话框的属性?比如:对话框标题,对话框消息,对话框按钮等等

设置对话框属性的两种方式

第一种:设置AlertDialog对象属性,具体代码如下:

private void showDialog() { 
    AlertDialog mDialog = null; 
    mDialog = new AlertDialog.Builder(this).create();; 
     
    mDialog.setIcon(R.drawable.ic_launcher); 
    mDialog.setTitle("系统提示"); 
    mDialog.setMessage("你确定要退出吗?"); 
    mDialog.setButton(DialogInterface.BUTTON_POSITIVE,"确定",new DialogInterface.OnClickListener() { 
       
      @Override 
      public void onClick(DialogInterface dialog,int which) { 
         
        finishMyself(); 
      } 
       
    }); 
    mDialog.setButton(DialogInterface.BUTTON_NEGATIVE,"取消",int which) { 
        Toast.makeText(MainActivity.this,"再按一次退出程序",(int) touchTime) 
        .show(); 
         
      } 
    }); 
     
    mDialog.show(); 
     
  } 

第二种:设置Builder对象属性,具体代码如下:

private void showDialog() { 
    AlertDialog mDialog = null; 
    Builder mBuilder = new AlertDialog.Builder(this); 
     
    mBuilder.setIcon(R.drawable.ic_launcher); 
    mBuilder.setTitle("系统提示"); 
    mBuilder.setMessage("你确定要退出吗?"); 
    mBuilder.setPositiveButton("确定",new DialogInterface.OnClickListener() { 
 
      @Override 
      public void onClick(DialogInterface dialog,int which) { 
 
        finish(); 
      } 
 
    }); 
    mBuilder.setNegativeButton("取消",(int) touchTime) 
            .show(); 
 
      } 
    }); 
 
    mDialog = mBuilder.create();//创建AlertDialog对象 
 
    mDialog.show();//显示创建的AlertDialog 
 
  } 

这两种方式的对话框展示默认属性――对话框水平垂直居中显示,对话框与左右窗体之间有一小段距离,效果图如下:

如何修改默认对话框属性?

如何修改AlertDialog对话框默认属性,然后实现对话框内容宽度布满屏幕,高度根据内容自适应,类似文章开头点击分享按钮,从底部弹出弹窗的效果。首先创建AlertDialog对话框,然后自定义对话框的布局View,最后设置Window对象属性。

设置Window对象屏幕宽度/高度的三种方式

第一种方式:setLayout()

获得Window对象后,设置Window对象的布局参数,即调用setLayout(int width,int height)方法,width取值:android.view.WindowManager.LayoutParams.MATCH_PARENT/android.view.WindowManager.LayoutParams.WRAP_CONTENT,同理height取值:android.view.WindowManager.LayoutParams.MATCH_PARENT/android.view.WindowManager.LayoutParams.WRAP_CONTENT,具体代码如下:

View view = getLayoutInflater().inflate(R.layout.popup_dialog,null); 
AlertDialog mDialog = new AlertDialog.Builder(this).create(); 
    mDialog.show();// 显示创建的AlertDialog,并显示,必须放在Window设置属性之前 
 
/** 
 *设置mDialog窗口属性:MATCH_PARENT/WRAP_CONTENT 
 * 
 */ 
Window window =mDialog.getwindow(); 
    window.setGravity(Gravity.BottOM); // 此处可以设置dialog显示的位置 
    window.setLayout(android.view.WindowManager.LayoutParams.MATCH_PARENT,android.view.WindowManager.LayoutParams.WRAP_CONTENT); 

第二种方式:setAttributes()

获得Window对象后,设置Window对象的属性值,即调用setAttributes(LayoutParams)方法,LayoutParams的width变量取值:android.view.WindowManager.LayoutParams.MATCH_PARENT/android.view.WindowManager.LayoutParams.WRAP_CONTENT,同理height变量取值:android.view.WindowManager.LayoutParams.MATCH_PARENT/android.view.WindowManager.LayoutParams.WRAP_CONTENT,具体代码如下:

View view = getLayoutInflater().inflate(R.layout.popup_dialog,null); 
AlertDialog mDialog = new AlertDialog.Builder(this).create(); 
    mDialog.show();// 显示创建的AlertDialog,并显示,必须放在Window设置属性之前 
 
Window window =mDialog.getwindow(); 
     window.setGravity(Gravity.BottOM); // 此处可以设置dialog显示的位置 
WindowManager.LayoutParams mParams = window.getAttributes(); 
     mParams.width = android.view.WindowManager.LayoutParams.MATCH_PARENT; 
     mParams.height = android.view.WindowManager.LayoutParams.WRAP_CONTENT; 
     window.setGravity(Gravity.BottOM); // 此处可以设置dialog显示的位置 
     window.setAttributes(mParams); 

第三种方式:setLayout()

具体代码如下:

View view = getLayoutInflater().inflate(R.layout.popup_dialog,null); 
AlertDialog mDialog = new AlertDialog.Builder(this).create(); 
    mDialog.show();// 显示创建的AlertDialog,并显示,必须放在Window设置属性之前 
 
Window window =mDialog.getwindow(); 
    window.setGravity(Gravity.BottOM); // 此处可以设置dialog显示的位置 
WindowManager manager = getwindowManager(); 
     display display = manager.getDefaultdisplay(); 
     int width = display.getWidth();//获取当前屏幕宽度 
     int height = 300;//自定义高度值,比如:300dp 
     window.setGravity(Gravity.BottOM); // 此处可以设置dialog显示的位置 
     window.setLayout(width,height); 

三.弹窗动画基础知识
Android的基本动画包括:渐变动画/平移动画/缩放动画/旋转动画/组合动画,点击“分享”按钮,弹窗从底部弹窗,再次点击弹窗消失,设置的动画――平移动画,代码如下:

<?xml version="1.0" encoding="utf-8"?> 
<!--enter_dialog_anim.xml,弹窗进入动画--> 
<translate xmlns:android="http://schemas.android.com/apk/res/android" 
  android:duration="300" 
  android:fromYDelta="100%"> 
 
</translate> 
<?xml version="1.0" encoding="utf-8"?> 
<!--exit_dialog_anim.xml,弹窗退出动画--> 
<translate xmlns:android="http://schemas.android.com/apk/res/android" 
  android:duration="300" 
  android:toYDelta="100%" > 
 
</translate> 

在style.xml文件中添加Window进入和退出分别引用的动画类型,代码如下:

<!-- 分享功能弹窗动画 --> 
<style name="popup_style" parent="android:Animation"> 
    <item name="@android:windowEnteranimation">@anim/enter_dialog_anim</item> 
    <item name="@android:windowExitAnimation">@anim/exit_dialog_anim</item> 
</style> 

在Window属性设置中调用setContentView()指定View对象,同时调用setwindowAnimations()指定添加的动画,代码如下:

window.setContentView(view);//这一步必须指定,否则不出现弹窗 
window.setwindowAnimations(R.style.popup_style); // 添加动画 
四.自定义弹窗:MyDialogActivity
自定义MyDialogActivity实现AlertDialog同样的功能,点击“分享按钮”,从窗口底部弹出弹窗,点击“取消”弹窗消息,最终效果和AlertDialog实现的弹窗效果一模一样,如下图:

开发步骤:

1.定义布局popup_main.xml。popup_main.xml定义弹窗最终展示的样子,可以放置多个平台的分享按钮,比如:微信/微博/空间/人人等,代码如下:

<?xml version="1.0" encoding="utf-8"?> 
<!-- 底部弹窗布局 --> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="match_parent" 
  android:layout_height="match_parent" 
  android:background="@color/transparent" 
  android:orientation="vertical" > 
 
  <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" > 
 
    <TextView 
      android:id="@+id/share_weibo_tv" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_margin="@dimen/share_padding" 
      android:layout_weight="1" 
      android:gravity="center_horizontal" 
      android:text="@string/weibo" /> 
 
    <TextView 
      android:id="@+id/share_weixin_tv" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_margin="@dimen/share_padding" 
      android:layout_weight="1" 
      android:gravity="center_horizontal" 
      android:text="@string/weixin" /> 
  </LinearLayout> 
 
  <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" > 
 
    <TextView 
      android:id="@+id/share_kongjian_tv" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_margin="@dimen/share_padding" 
      android:layout_weight="1" 
      android:gravity="center_horizontal" 
      android:text="@string/kongjian" /> 
 
    <TextView 
      android:id="@+id/share_qq_tv" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_margin="@dimen/share_padding" 
      android:layout_weight="1" 
      android:gravity="center_horizontal" 
      android:text="@string/qq" /> 
  </LinearLayout> 
 
  <Button 
    android:id="@+id/cancel_btn" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="@dimen/activity_vertical_margin" 
    android:background="@drawable/btn_bg" 
    android:text="@string/cancel" /> 
 
</LinearLayout> 

2.定义Theme样式。Theme样式定义在style.xml文件中,在AndroidManifest.xml文件中的标签的android:theme=""属性中引用,代码如下:

<!-- MyDialogActivity自定义Threme --> 
<style name="Theme.CustomDialog" parent="@android:style/Theme.Dialog"> 
    <item name="android:windowNoTitle">true</item> 
    <!-- 设置title --> 
    <item name="android:windowBackground">@android:color/transparent</item> 
    <item name="android:windowFrame">@null</item> 
    <!-- 设置边框 --> 
    <item name="android:windowIsTranslucent">true</item> 
    <!-- 设置半透明 --> 
    <item name="android:windowFullscreen">true</item> 
    <!-- 设置全屏 --> 
</style> 
<activity android:name="MyDialogActivity" android:theme="@style/Theme.CustomDialog"/> 

3.实现MyDialogActivity具体功能。

package cn.teachcourse.main; 
 
import android.annotation.SuppressLint; 
import android.app.Activity; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.graphics.drawable.BitmapDrawable; 
import android.graphics.drawable.Drawable; 
import android.os.Bundle; 
import android.view.Gravity; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.view.Window; 
import android.widget.Button; 
import android.widget.TextView; 
 
/* 
 @author postmaster@teachcourse.cn 
 @date 创建于:2016-4-14 
 */ 
public class MyDialogActivity extends Activity implements OnClickListener { 
  private View view; 
 
  @Override 
  protected void onCreate(Bundle savedInstanceState) { 
    // Todo Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    view = getLayoutInflater().inflate(R.layout.popup_main,null,false); 
    setContentView(view); 
    initView(); 
  } 
 
  private void initView() { 
    Window window = getwindow(); 
    window.setLayout(android.view.ViewGroup.LayoutParams.MATCH_PARENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT); 
    window.setGravity(Gravity.BottOM); 
    window.setwindowAnimations(R.style.popup_style); // 添加动画 
 
    TextView weibo_tv = (TextView) view.findViewById(R.id.share_weibo_tv); 
    TextView weixin_tv = (TextView) view.findViewById(R.id.share_weixin_tv); 
    TextView qq_tv = (TextView) view.findViewById(R.id.share_qq_tv); 
    TextView kongjian_tv = (TextView) view 
        .findViewById(R.id.share_kongjian_tv); 
    Button cancel_btn = (Button) view.findViewById(R.id.cancel_btn); 
    // 添加控件事件 
    weibo_tv.setonClickListener(this); 
    weixin_tv.setonClickListener(this); 
    qq_tv.setonClickListener(this); 
    kongjian_tv.setonClickListener(this); 
    cancel_btn.setonClickListener(this); 
     
    // 调整图片的大小/位置 
    abjustDrawablePos(weibo_tv,R.drawable.share_weibo); 
    abjustDrawablePos(weixin_tv,R.drawable.share_weixin); 
    abjustDrawablePos(kongjian_tv,R.drawable.share_kongjian); 
    abjustDrawablePos(qq_tv,R.drawable.share_qq); 
 
  } 
 
  /** 
   * 添加图标和调整位置 
   * 
   * @param tv 
   * @param draw 
   */ 
  @SuppressLint("ResourceAsColor") 
  private void abjustDrawablePos(TextView tv,int draw) { 
    Bitmap mBitmap = BitmapFactory.decodeResource(getResources(),draw); 
    mBitmap = centerSquareScaleBitmap(mBitmap,250); 
    Drawable drawable = new BitmapDrawable(mBitmap); 
    drawable.setBounds(0,48,48);// 设置图片的边界 
    tv.setTextColor(R.color.fontcolor); 
    tv.setCompoundDrawables(null,drawable,null);// setCompoundDrawables()和setBounds()方法一起使用 
    // 添加TextView图标 
    tv.setCompoundDrawablesWithIntrinsicBounds(null,null); 
    tv.setCompoundDrawablePadding(10);// 设置图片和text之间的间距 
    if (mBitmap != null) { 
      mBitmap = null; 
      drawable = null; 
    } 
  } 
 
  /** 
   * 
   * @param bitmap 
   *      原图 
   * @param edgeLength 
   *      希望得到的正方形部分的边长 
   * @return 缩放截取正中部分后的位图。 
   */ 
  public static Bitmap centerSquareScaleBitmap(Bitmap bitmap,int edgeLength) { 
    if (null == bitmap || edgeLength <= 0) { 
      return null; 
    } 
 
    Bitmap result = bitmap; 
    int widthOrg = bitmap.getWidth(); 
    int heightOrg = bitmap.getHeight(); 
 
    if (widthOrg >= edgeLength && heightOrg >= edgeLength) { 
      // 压缩到一个最小长度是edgeLength的bitmap 
      int longerEdge = (int) (edgeLength * Math.max(widthOrg,heightOrg) / Math 
          .min(widthOrg,heightOrg)); 
 
      int scaledWidth = widthOrg > heightOrg ? longerEdge : edgeLength; 
      int scaledHeight = widthOrg > heightOrg ? edgeLength : longerEdge; 
      Bitmap scaledBitmap; 
 
      try { 
        scaledBitmap = Bitmap.createScaledBitmap(bitmap,scaledWidth,scaledHeight,true); 
      } catch (Exception e) { 
        return null; 
      } 
 
      // 从图中截取正中间的正方形部分。 
      int xTopLeft = (scaledWidth - edgeLength) / 2; 
      int yTopLeft = (scaledHeight - edgeLength) / 2; 
 
      try { 
        result = Bitmap.createBitmap(scaledBitmap,xTopLeft,yTopLeft,edgeLength,edgeLength); 
        scaledBitmap.recycle(); 
      } catch (Exception e) { 
        return null; 
      } 
    } 
 
    return result; 
  } 
 
  @Override 
  public void onClick(View v) { 
    switch (v.getId()) { 
    /** 
     * 点击分享图标,弹出分享界面 
     */ 
    case R.id.share_to_btn: 
       
      break; 
    case R.id.share_weibo_tv: 
 
      break; 
    case R.id.share_weixin_tv: 
 
      break; 
    case R.id.share_qq_tv: 
 
      break; 
    case R.id.share_kongjian_tv: 
 
      break; 
    case R.id.cancel_btn: 
      finish(); 
       
      break; 
 
    default: 
      break; 
    } 
 
  } 
} 

 4.弹出弹窗,调用startActivity(this,MyDialogActivity.class)。

以上就是本文的全部内容,希望对大家学习Android软件编程有所帮助。

Android Facebook开发人员无法在“ Android Key Hash”的“示例应用程序设置”上“保存更改”

Android Facebook开发人员无法在“ Android Key Hash”的“示例应用程序设置”上“保存更改”

您好Stackoverflow社区,

我登录developers.facebook.com,并尝试在“ Android哈希”的“示例应用程序设置”中点击“保存更改”. (输入Android密钥哈希后)

过去,我已经保存了另外两个Android密钥哈希(因为我切换了计算机/努力寻找正确的密钥哈希值),但是现在我无法添加第三个密钥哈希值.

我的第一个猜测是我找到的密钥无效,但这是我从https://developers.facebook.com/docs/android/login-with-facebook/的指示中获得的,所以我对此表示怀疑.

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

try {
    PackageInfo info = getPackageManager().getPackageInfo(
        "com.replaced.with.my.pakage.name.here", 
        PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodetoString(md.digest(), Base64.DEFAULT));
        }
} catch (NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}
...

我似乎已被锁定?关于如何解决此错误的任何想法?

解决方法:

我意识到从Facebook获得的哈希键中和使用keytool命令生成的哈希键中的字符数是不相同的,因为我未启用“保存更改”按钮.较短的一个就可以了

Android facebook登录无法使用已安装的Facebook应用程序

Android facebook登录无法使用已安装的Facebook应用程序

我已经设置了简单的Facebook登录.对于 Android 2.3.6,所有功能都应该如此,用户获得提示登录对话框,输入数据和应用程序继续.我以为这是android版本的错误,但是当手机上安装了Facebook应用程序时,会发现登录不起作用!

测试了:
galaxy Ace 2.3.6
HTC Desire 4.1.2
银河笔记4.1.2
Android模拟器4.1.2

即使Facebook的样品也不工作!

每次应用执行时 – else {
Log.d(“SESSION NOT OPENED”,“SESSION NOT OPENED”);
}

似乎会话没有打开,但为什么呢?按照本指南 – https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

码:

Session.openActiveSession(this,true,new Session.StatusCallback() {

        @Override
        public void call(final Session session,SessionState state,Exception exception) {

            if (session.isOpened()) {

                Request.executeMeRequestAsync(session,new Request.GraphUserCallback() {

                    @Override
                    public void onCompleted(GraphUser user,Response response) {
                        if (user != null) {
                            Log.d("Access_token",session.getAccesstoken());
                        }
                    }
                });
            } else {
                Log.d("SESSION NOT OPENED","SESSION NOT OPENED");
            }
        }
    });

解决方法

查看步骤4: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/的底部

如果您没有正确输入应用程序密钥哈希,Facebook通过WebView弹出窗口登录(如果该应用未安装)仍然可以正常工作,但是通过本机的Facebook应用程序登录将不会.

您应该在LogCat中看到这个异常:

com.facebook.http.protocol.ApiException: remote_app_id does not match stored id

Facebook SDK打印其例外,如果还有其他问题,请检查.

android – Facebook me / feed只能在开发者帐户上发布

android – Facebook me / feed只能在开发者帐户上发布

我在这里遇到一个奇怪的情况.虽然发布到Facebook我希望我的应用程序绕过对话框要求写一些东西并显示我自己的自定义对话框.因此我必须使用“我/饲料”.该应用程序工作正常我在开发者帐户中发布了一些内容.但是当我尝试在其他帐户中发帖时,它有时会返回任何内容或某些时候返回:

08-21 12:26:29.332: D/Facebook-Util(6796): POST URL: https://graph.facebook.com/me/Feed
08-21 12:26:29.722: D/Tests(6796): got response: {"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200}}

我真的很困惑我在这里做了什么错.为什么消息不是开发者帐户以外的帖子..?

这是我的相关代码:

if (facebook.isSessionValid()) {
                            facebook.authorize(BoonDriveActivity.this,
                                    new String[] { "publish_stream","publish_actions","manage_pages","status_update"},//This are the permissions
                                    new DialogListener() {

                                        @Override
                                        public void onCancel() {
                                            // Function to handle cancel event
                                        }

                                        @Override
                                        public void onComplete(Bundle values) {
                                            // Function to handle complete event
                                            // Edit Preferences and update facebook acess_token
                                            final SharedPreferences.Editor editor = mPrefs.edit();
                                            editor.putString("access_token",
                                                    facebook.getAccesstoken());
                                            editor.putLong("access_expires",
                                                    facebook.getAccessExpires());
                                            editor.commit();
                                            LayoutInflater inflater=BoonDriveActivity.this.getLayoutInflater();
                                            View layout=inflater.inflate(R.layout.createsharedialoglinkedin,null);
                                            final AlertDialog d1 = new AlertDialog.Builder(BoonDriveActivity.this)
                                            // Your other options here ...
                                            .setView(layout)
                                            .create();//My custom dialog
                                            d1.getwindow().setSoftInputMode(WindowManager.LayoutParams.soFT_INPUT_ADJUST_RESIZE);
                                            d1.show();
                                            lntxtfilename=(TextView)layout.findViewById(R.id.txtfilename);
                                            lnetmessage=(EditText)layout.findViewById(R.id.et_message);
                                            ln_btn_share=(Button)layout.findViewById(R.id.btn_share);
                                            ln_btn_showlink=(Button)layout.findViewById(R.id.btn_showlink);
                                            lnshowlink=(EditText)layout.findViewById(R.id.et_showlink);
                                            ln_btn_share.setText("SHARE ON FACEBOOK");
                                            ln_btn_showlink.setonClickListener(new View.OnClickListener() {

                                                @Override
                                                public void onClick(View v) {
                                                    // Todo Auto-generated method stub
                                                    ln_btn_showlink.setVisibility(View.GONE);
                                                    lnshowlink.setVisibility(View.VISIBLE);
                                                    lnshowlink.setText(finallink);
                                                }
                                            });
                                            lntxtfilename.setText("Share"+" "+filename+" "+"with:");

                                            ln_btn_share.setonClickListener(new View.OnClickListener() {

                                                @Override
                                                public void onClick(View v) {
                                                    // Todo Auto-generated method stub
                                                    //String s = ((GlobalFilename)BoonDriveActivity.this.getApplication()).getGlobalState();
                                                    if(lnetmessage.length()==0)
                                                    {
                                                        Toast.makeText(BoonDriveActivity.this,"Please enter message",Toast.LENGTH_LONG).show();
                                                    }
                                                    else{
                                                    String share1 = lnetmessage.getText().toString();
                                                    //String finalmsg=share1+"\n"+s;
                                                    System.out.println("This is the final msg linkedin--->"+ finallink);
                                                    //lnetmessage.setText(finalmsg);
                                                    //postToWall();
                                                    postToWall(share1,finallink);
                                                     d1.dismiss();
                                                    }
                                                }
                                            });



                                        }

                                        @Override
                                        public void one rror(DialogError error) {
                                            // Function to handle error

                                        }

                                        @Override
                                        public void onFacebookError(FacebookError fberror) {
                                            // Function to handle Facebook errors

                                        }

                                    });
                        }



                    } 

我搜索了很多关于这个,但找不到解决方案.请帮忙.

我使用以下方法发布到墙上:

@SuppressWarnings("deprecation")
    public void postToWall(String message,String link){

        Bundle parameters = new Bundle();

                parameters.putString("message", message+link);
               // parameters.putString("link",link);
               /* parameters.putString("description", "topic share");
                parameters.putString("picture", link);*/
                try {
                     String response = facebook.request("me");
                    facebook.request("me");
             response = facebook.request("me/Feed", parameters, "POST");
            Log.d("Tests", "got response: " + response);
            if (response == null || response.equals("") ||
                    response.equals("false")) {
                showToast("Blank response.");
            }
            else {
                showToast("Message posted to your facebook wall!");
            }

        } catch (Exception e) {
            showToast("Failed to post to wall!");
            e.printstacktrace();

        }
    }

解决方法:

如果您的应用尚未经过审核,则此应用的管理员和开发者之外的其他任何用户都无法提供相应的权限.

这在文档中描述:

> https://developers.facebook.com/docs/apps/review/login#do-you-need-review

引用:

If you’re the developer of an app and are the only person using it, then your app doesn’t need to go through review. Since you’re the developer, all app capabilities should be available. You will still need to take your app out of developer mode, but you should be able to do that without going through review.

而且,BTW,没有status_update权限……

今天关于非开发人员帐户几秒钟后,Android Facebook共享对话框消失facebook处于开发模式的介绍到此结束,谢谢您的阅读,有关Android AlertDialog实现分享对话框/退出对话框/下载对话框、Android Facebook开发人员无法在“ Android Key Hash”的“示例应用程序设置”上“保存更改”、Android facebook登录无法使用已安装的Facebook应用程序、android – Facebook me / feed只能在开发者帐户上发布等更多相关知识的信息可以在本站进行查询。

本文标签: