问题描述
Instagram的Android版是非常有限的,从我迄今所看到的。我的方案很简单:让用户编辑图片,当他点击发送:
Instagram for Android is very limited, from what I have seen so far. My scenario is simple: allow the user to edit a picture and when he clicks on Send:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
然后用 queryIntentActivities()
我搜索,看看是否安装Instagram的。如果是我送我的形象的路径被上传:
Then with queryIntentActivities()
I search to see if Instagram is installed. If it is I send the path of my image to be uploaded:
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///" + path to myfile.png"));
share.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
share.putExtra(Intent.EXTRA_SUBJECT, "Sample subject");
share.putExtra(Intent.EXTRA_TEXT, "Sample text");
share.putExtra(Intent.EXTRA_TITLE, "Sample title");
结果:该图像是使用Instagram的应用程序上传(当然,如果我登录),但我不能一个标题添加到它。没有一个 putExtra
有任何影响。那么,有没有什么办法可以增加一个标题为目的参数?
The result: the image is uploaded using Instagram app (of course if I am logged in), but I can't add a Caption to it. None of the putExtra
has any effect. So, is there any way to add a caption as intent parameter ?
和其他的问题,是有可能打开与填充某个用户名Instagram的应用程序?
And the other question, is it possible to open Instagram app with a certain user name filled in ?
推荐答案
这看起来好像Instagram的的Android应用程序忽略EXTRA_TEXT,EXTRA_SUBJECT和EXTRA_TITLE,如此看来,添加字幕,同时上传图片是不可能的。顺便说一句,你可以尝试不同的方法来检查,如果它忽略了那些群众演员在任何情况下:
It looks as if Instagram's Android App ignores EXTRA_TEXT, EXTRA_SUBJECT and EXTRA_TITLE, so it seems that adding a caption while uploading an image is not possible. By the way, you can try different approaches to check if it ignores those extras in every case:
选项#1:更改MIME类型
OPTION #1: Changing the MIME type.
正在设置MIME类型为图像/ JPEG。尝试使用图像/ 或的/ *来检查,如果他们的应用程序不会忽略这些附加功能。
You are setting the MIME type to "image/jpeg". Try using "image/" or "/*" to check if their app doesn't ignore those extras.
share.setType("image/*");
或
share.setType("*/*");
选项2:
当你发送多个MIME类型(图片和文字),也许他们的应用程序是ACTION_SEND_MULTIPLE期待,而不是ACTION_SEND。
As you are sending multiple MIME types (image and text), maybe their app is expecting ACTION_SEND_MULTIPLE instead of ACTION_SEND.
Intent share = new Intent(Intent.ACTION_SEND_MULTIPLE);
选项#3:使用 MediaStore.Images.Media.insertImage(ContentResolver的CR,字符串的ImagePath,字符串名称,字符串描述)
功能:
Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getContentResolver(), "file:///" + path to myfile.png", "Sample title", "Sample description")));
share.setType("image/jpeg");
share.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
第4个选项:发表您的问题,在他们的开发者论坛,虽然还有一些尚未解决类似的问题:
OPTION #4: Post your issue in their developer forum, although there are similar questions that remain unsolved:
-
<一个href="https://groups.google.com/forum/?fromgroups#!searchin/instagram-api-developers/caption%2420action_send/instagram-api-developers/PJDuG2sTDlM/6bno5dZmoTEJ">https://groups.google.com/forum/?fromgroups#!searchin/instagram-api-developers/caption$20action_send/instagram-api-developers/PJDuG2sTDlM/6bno5dZmoTEJ
<一个href="https://groups.google.com/forum/?fromgroups#!searchin/instagram-api-developers/caption/instagram-api-developers/7XUKm9HSAdg/rJbdSnOmXacJ">https://groups.google.com/forum/?fromgroups#!searchin/instagram-api-developers/caption/instagram-api-developers/7XUKm9HSAdg/rJbdSnOmXacJ
不要忘了回来,并告诉我们,他们的回答!
And don't forget to come back and tell us their answer!
这篇关于从Instagram的Android的某些用户开放,并添加标题为上传的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!