我基本上想要的是从另一个应用程序打开Instagram应用程序,并发送带有标题的图像。在iOS中有一些有用的文档可以做到这一点。(iPhone挂钩)
Instagram是否支持按iPhone-hooks中的说明在Android中(如在iOS中)执行自定义操作?
以下是我的应用程序中用来部分执行此任务的当前代码。
private void sendImageToIntagram(Activity activity) {
Intent intent = activity.getPackageManager().getLaunchIntentForPackage("com.instagram.android");
if (intent != null) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setPackage("com.instagram.android");
String imagePath = ImageUtil.getProcessedImage().getAbsolutePath();
try {
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(activity.getContentResolver(), imagePath, "Title", "Description")));
// shareIntent.putExtra(Intent.EXTRA_TITLE, "Caption 01");
// shareIntent.putExtra(Intent.EXTRA_TEXT, "Caption 02");
// shareIntent.putExtra(Intent.EXTRA_SUBJECT,"Caption 03");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
shareIntent.setType("image/jpeg");
activity.startActivity(shareIntent);
} else {
// bring user to the market to download the app.
intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("market://details?id=" + "com.instagram.android")); …Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,它将在不同的社交网站上共享内容.问题是我无法在共享意图中看到Instagram选项.我可以看到蓝牙,邮件,消息等,但无法看到Instagram.我的设备上安装了Instagram应用程序.谁能告诉我这是什么问题?
其次有没有办法自定义共享意图中的选项?就像我想要从中排除消息.可能吗?