Android Facebook图像共享在emulator中工作,但在设备中不工作
现在我正在开发一个Android应用程序。在我的应用程序中,我必须将图片从我的图库提交到facebookAndroid Facebook图像共享在emulator中工作,但在设备中不工作,android,Android,现在我正在开发一个Android应用程序。在我的应用程序中,我必须将图片从我的图库提交到facebook if (item == 1) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.create
if (item == 1) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Complete action using"), PICK_FROM_FILE);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (resultCode != RESULT_OK) return;
Bitmap bitmap = null;
if (requestCode == PICK_FROM_FILE) {
mImageCaptureUri = data.getData();
mPath = getRealPathFromURI(mImageCaptureUri); //from Gallery
if (mPath == null){
mPath = mImageCaptureUri.getPath(); //from File Manager
}
if (mPath != null) {
System.out.println("mpath is not null"+mPath);
bitmap = BitmapFactory.decodeFile(mPath);
}
}
}
private void postToFacebook(String desc){
AsyncFacebookRunner mAsyncFbRunner = new AsyncFacebookRunner(mFacebook);
Bundle params = new Bundle();
try {
params.putByteArray("photo",
Utility.scaleImage(getApplicationContext(),mImageCaptureUri));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
params.putString("caption", desc);
mAsyncFbRunner.request("me/photos", params, "POST",
new PhotoUploadListener());
}
它在模拟器中对我来说工作正常,但在真实设备中,映像没有发布。但没有崩溃。请帮助我的朋友们首先查看清单,这可能会对您有所帮助
android.permission.MANAGE_ACCOUNTS
先检查你的舱单,希望这对你有帮助
android.permission.MANAGE_ACCOUNTS