【发布时间】:2015-09-14 07:01:03
【问题描述】:
我必须将我的应用程序中的图像分享到 instagram。我浏览了 Instagram 开发者文档,他们只提到了通过 Intent 方法进行分享,但我需要的是在成功发布后我必须得到回调。
private void createInstagramIntent(String type, String mediaPath){
// Create the new Intent using the 'Send' action.
Intent share = new Intent(Intent.ACTION_SEND);
// Set the MIME type
share.setType(type);
// Create the URI from the media
File media = new File(mediaPath);
Uri uri = Uri.fromFile(media);
// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);
// Broadcast the Intent.
startActivity(Intent.createChooser(share, "Share to"));
}
有什么办法吗?
【问题讨论】:
-
@rekire 当然会得到一个回调到 startActivityForResult。但我们无法确定用户是否共享。如果你按下后退按钮,也会调用 startActivityForResult
-
他们的 API 很安静:instagram.com/developer/mobile-sharing/android-intents 没有提供更多信息。
-
如果我的手机上没有安装 Instagram 怎么办?
-
@rekire 即使没有安装 Instagram,还有其他方法可以在 Android 应用中分享吗?
标签: android callback instagram sharing instagram-api