我正在开发一个类似于runkeeper的应用程序,用户可以在Facebook上跟踪他的活动和分享。我在具有相同API级别23的两个设备上测试它。共享在其中一个上完全正常。对于第二个设备,它看起来好像Facebook活动正在启动并立即崩溃。 以下是我的代码段
ShareOpenGraphObject.Builder object = new ShareOpenGraphObject.Builder()
.putString("fb:app_id", getString(R.string.facebook_app_id))
.putString("og:type", "fitness.course")
.putString("og:title", title)
.putString("og:url", url)
.putString("fitness:duration:value", "3600")
.putString("fitness:duration:units", "s")
.putString("fitness:distance:value", String.format("%.2f", distance))
.putString("fitness:distance:units", "km")
.putString("fitness:speed:value", "25")
.putString("fitness:speed:units", "m/s");
int i = 0;
for(Location loc: locationArray){
object.putDouble("fitness:metrics["+i+"]:location:latitude", loc.latitude);
object.putDouble("fitness:metrics["+i+"]:location:longitude", loc.longitude);
i++;
}
// Create an action
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("fitness.walks")
.putObject("fitness:course", object.build())
.build();
// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("fitness:course")
.setAction(action)
.build();
ShareDialog shareDialog = new ShareDialog(this);
if (shareDialog.canShow(ShareOpenGraphContent.class)) {
shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
}
logcat显示以下错误
01-16 20:32:41.807 1767-3108/? I/ActivityManager: START u0 {act=com.facebook.platform.PLATFORM_ACTIVITY cat=[android.intent.category.DEFAULT] pkg=com.facebook.katana cmp=com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity (has extras)} from uid 10337 on display 0
01-16 20:32:41.893 5230-5230/ I/Choreographer: Skipped 946 frames! The application may be doing too much work on its main thread.
01-16 20:32:42.094 11818-12203/? V/ConnectivityManager: isActiveNetworkMetered() returns:true
01-16 20:32:42.179 11818-12124/? E/X.0SQ: RuntimeException while executing runnable com.google.common.util.concurrent.Futures$6@841f317 with executor X.0TB@f2c51c6
java.lang.IllegalArgumentException
at X.0PB.checkArgument(:55122)
at com.facebook.ipc.composer.intent.ComposerConfiguration.<init>(:1303891)
at com.facebook.ipc.composer.intent.ComposerConfiguration$Builder.a(:1303267)
at X.Gvr.onSuccess(:2406163)
at com.google.common.util.concurrent.Futures$6.run(:68028)
at X.0TB.execute(:62606)
at X.03X.a(:10463)
at X.0SQ.executeListener(:61282)
at X.0SQ.complete(:61256)
at X.0SQ.completeWithFuture(:61263)
at X.0SQ.setFuture(:61159)
at com.google.common.util.concurrent.Futures$AsyncChainingFuture.a(:310870)
at com.google.common.util.concurrent.Futures$AbstractChainingFuture.run(:247912)
at com.google.common.util.concurrent.Futures$2$1.run(:311624)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at com.facebook.common.executors.WrappingExecutorService$1.run(:77498)
at com.facebook.common.executors.DefaultConstrainedListeningExecutorService$Worker.run(:63229)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.facebook.common.executors.NamedThreadFactory$1.run(:77690)
at java.lang.Thread.run(Thread.java:818)
01-16 20:32:42.211 1767-1863/? I/LaunchCheckinHandler: Displayed com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity,wp,ca,303
01-16 20:32:42.211 1767-1863/? I/ActivityManager: Displayed com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity: +303ms
01-16 20:32:42.436 2425-2980/? I/NetworkController.MotorolaMobileSignalController(1): MotorolaMobilePhoneStateListener.onDataActivity: Entered: direction=3
任何想法? TIA
EDIT1 因此,该特定设备上的错误突然消失,没有任何改变。所以我非常肯定Facebook在他们身边修了一些东西。但是这个问题仍然存在于少数设备上。如果需要,我会发布更新