此問題看起來很相似,但決不會涉及「使用Facebook sdk在Facebook上分享視頻」或「使用共享意圖共享純文本或圖像」。 我按照這些職位上的SO - >使用Android共享在Facebook上分享視頻Intent
Android share intent for Facebook
How to share photo with CAPTION via Android share intent on Facebook?
和這個外部鏈接
http://sudarmuthu.com/blog/sharing-content-in-android-using-action_send-intent
,並來了解在Android的份額意圖可以是啓動後與Android Phone上的現有共享應用程序共享圖像/視頻/文本。 我用這個代碼在Facebook上共享圖像:
package com.mypackage.share;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class FbshareActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpg");
share.putExtra(Intent.EXTRA_STREAM,Uri.parse("file:///mnt/sdcard/tutu.jpg"));
startActivity(Intent.createChooser(share, "Share Image"));
}
}
的清單文件如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage.share"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".FbshareActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
它的工作原理fine.I我能夠在Facebook上共享圖像。
現在我想上傳的視頻: 我換成這一行: share.setType( 「圖像/ JPG」);
與此
share.setType(「video/3gpp」);
和這一個 share.putExtra(Intent.EXTRA_STREAM,Uri.parse( 「**文件:///mnt/sdcard/dimg1333456357958.jpg」)); ** 與這一個
share.putExtra(Intent.EXTRA_STREAM,Uri.parse( 「**文件:///mnt/sdcard/a123bghy4.3gpp」)); **
但我正在逐漸上運行的代碼此錯誤:
/Environment(30996): getExternalStorageState/mnt/sdcard
E/Environment(30996): getExternalStorageList
W/MountService(2879): getVolumeState(/mnt/sdcard/external_sd): Unknown volume
W/MountService(2879): getVolumeState(/mnt/sdcard/external_sd): Unknown volume
E/Environment(30996): getExternalStorageState/mnt/sdcard
D/SurfaceFlinger(2879): [JJ]removeSurface for sid=74
D/dalvikvm(30996): GC_CONCURRENT freed 1106K, 19% free 8612K/10503K, paused 3ms+5ms
E/SurfaceFlinger(2879): [JJ]SurfaceFlinger FPS: 24.994677
D/ACRA (30996): Writing crash report file.
D/ACRA (30996): Mark all pending reports as approved.
D/ACRA (30996): Looking for error files in /data/data/com.facebook.katana/app_acra-reports
V/ACRA (30996): About to start ReportSenderWorker from #handleException
D/ACRA (30996): Add user comment to null
D/ACRA (30996): #checkAndSendReports - start
D/ACRA (30996): Looking for error files in /data/data/com.facebook.katana/app_acra-reports
I/ACRA (30996): Sending file 1333628258000-approved.stacktrace
D/ACRA (30996): Connect to https://www.facebook.com/mobile/android_crash_logs/
D/ACRA (30996): Setting httpPost headers
D/ACRA (30996): Sending request to https://www.facebook.com/mobile/android_crash_logs/
D/dalvikvm(30996): GC_CONCURRENT freed 631K, 18% free 8644K/10503K, paused 5ms+2ms
W/ResponseProcessCookies(30996): Invalid cookie header: "Set-Cookie: datr=ZY19T4_v6CV68jQn4FTduX_l; expires=Sat, 05-Apr-2014 12:17:41 GMT; path=/; domain=.facebook.com; httponly". Unable to parse expires attribute: Sat
E/SurfaceFlinger(2879): [JJ]SurfaceFlinger FPS: 4.741684
D/BatteryService(2879): update start
D/ACRA (30996): #checkAndSendReports - finish
E/AndroidRuntime(30996): FATAL EXCEPTION: main
E/AndroidRuntime(30996): java.lang.NullPointerException
E/AndroidRuntime(30996): at com.facebook.katana.service.method.VideoUpload.getRealPathFromURI(VideoUpload.java:144)
E/AndroidRuntime(30996): at com.facebook.katana.service.method.VideoUpload.start(VideoUpload.java:165)
E/AndroidRuntime(30996): at com.facebook.katana.binding.AppSession.postToService(AppSession.java:4212)
E/AndroidRuntime(30996): at com.facebook.katana.service.method.VideoUpload.RequestVideoUpload(VideoUpload.java:73)
E/AndroidRuntime(30996): at com.facebook.katana.activity.media.UploadVideoActivity.upload(UploadVideoActivity.java:209)
E/AndroidRuntime(30996): at com.facebook.katana.activity.media.UploadVideoActivity.onClick(UploadVideoActivity.java:169)
E/AndroidRuntime(30996): at android.view.View.performClick(View.java:3100)
E/AndroidRuntime(30996): at android.view.View$PerformClick.run(View.java:11644)
E/AndroidRuntime(30996): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime(30996): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(30996): at android.os.Looper.loop(Looper.java:126)
E/AndroidRuntime(30996): at android.app.ActivityThread.main(ActivityThread.java:4002)
E/AndroidRuntime(30996): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(30996): at java.lang.reflect.Method.invoke(Method.java:491)
E/AndroidRuntime(30996): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
E/AndroidRuntime(30996): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime(30996): at dalvik.system.NativeStart.main(Native Method)
D/SurfaceFlinger(2879): screenshot: sw=216, sh=135, minZ=0, maxZ=21015
W/ActivityManager(2879): Force finishing activity com.facebook.katana/.activity.media.UploadVideoActivity
D/SurfaceFlinger(2879): screenshot: result = OK
E/android.os.Debug(2879): Dumpstate > /data/log/dumpstate_app_com_facebook_katana_error
I/dumpstate(31581): begin
W/ActivityManager(2879): Activity pause timeout for ActivityRecord{40f51e68 com.facebook.katana/.activity.media.UploadVideoActivity}
F//system/bin/logcat(31586): stack corruption detected: aborted
W/PowerManagerService(2879): Timer 0x3->0x3|0x0
D/VoldCmdListener( 87): asec list
I/dumpstate(31581): done
D/InputTransport(2879): channel '41014710 Sorry! - Use *#9900# to take log - (server)' ~ mPointerStates->semaphore initialized 0x586ac000.
D/InputTransport(2879): channel '41014710 Sorry! - Use *#9900# to take log - (server)' ~ mPointerStates initialized 0x586ac000.
D/InputTransport(2879): channel '41014710 Sorry! - Use *#9900# to take log - (client)' ~ mPointerStates initialized 0x587f1000.
E/SurfaceFlinger(2879): [JJ]SurfaceFlinger FPS: 0.207880
D/SurfaceFlinger(2879): [JJ]createSurface for pid 31559 (1280 x 752)
D/SurfaceFlinger(2879): [JJ]createSurface for pid 2879 (1 x 1)
E/SurfaceFlinger(2879): [JJ]SurfaceFlinger FPS: 18.909105
我該怎麼辦調試com.facebook.katana? Plz assit。 Rgds
它工作嗎?你有自己測試過嗎? – Ehsan 2014-09-21 11:36:43
它不工作,我收到一個對話框,說沒有應用程序可以執行此操作 – 2015-04-16 19:26:07