I have my android application manifest file and I made a new activity. I want this activity to be able to handle images just like the built in image viewer. So I can tap an image in the browser, and it will ask if i want to use my application, or the default activity to view the image. What action can I use in the following intent filter:
<intent-filter>
<action android:name="android.intent.action." />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
I assume it would be listed at http://developer.android.com/reference/android/content/Intent.html but I cannot figure out which one is for viewing images.
You are looking for android.intent.action.VIEW
Intent.html#ACTION_VIEW
Related
I am developing an android app which accepts deeplink. For example consider this one:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="returnapp" android:scheme="testscheme" />
</intent-filter>
So if we call the url testscheme://returnapp/?status=1 then app should be opened.
In Google Chrome it opens up and everything goes right but in firefox, the app gets opened as child of browser task (which has the link to my app). But I want it to be opened independently.
So is there something to add to manifest to force this attribute or I should add some keyword in my HTML href?
UPDATE
I think I should make a change in the link showing in webpage in firefox. Currently I am using this link:
<h1>test</h1>
Something like target="_system" to tell firefox to open this link externally.
The browsers itself need to support and implment the browsability. The browsers have to find other activities supporting android.intent.category.BROWSABLE when opening a web-page.
So as you say, Firefox is not supported for opening app directly, however there is a solution you can try is to add android:autoVerify="true" in any one of the web URL intent filters in your app manifest that include the android.intent.action.VIEW intent action and android.intent.category.BROWSABLE intent category, as shown in the following manifest code snippet:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="returnapp" android:scheme="testscheme" />
</intent-filter>
Even though I'm still not sure this gonna work because of android:autoVerify="true" is for appLink not for deepLink
I am kind of stuck here, I have created a gallery app but for some reasons I do not know how to make it be recognized by the system as a gallery app so that I can pick images from it from other apps e.g Whatsapp, I see other 3rd party appearing on the menu except mine.
Add this in your Manifest
<activity android:name="YourActivity">
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
And then handle the intent when your activity gets opened and get the URI of the image from the EXTRAS.
I have this declared in my AndroidManifest.xml:
<activity
android:name="x.y.z.MyActivity"
android:label="#string/app_name"
android:theme="#style/MyTheme" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
What I am trying to do is to register my activity for sharing of images from other apps. This works for normal images from the Gallery but my app doesn't appear as option for sharing of images from the Gallery that are up on Picasa. I'm not sure what else to add to my intent-filter to cover also this use case.
Try
<data android:mimeType="*/*" />
and debug/log the type of the Intent sent by Picasa to add it to your intent filter.
I've used Intent Intercept app to intercept the intent from the Gallery.
Unfortunately I see that the mime type is text/plain and there is an extra that contains the link to the image. I can't use this mime type because my app is only able to handle images and not text (the app might show up in apps that share text and obviously I don't want that).
Short answer: this cannot be done if you don't also implement sharing of text.
I have looked at the intent-filter documentation and I can't figure out this specific intent-filter.
I'm looking to use ACTION_SEND because I only want the app to show up in "Share" menus in other apps. I only want to show up in the share menu if the text of the intent is a url. For example, what is shared from the Android Browser's share menu. I don't want the app to appear in the share menu if it's just text and not a url.
What I have so far is:
<intent-filter android:label="Label">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
However, this will receive any text, not just urls.
Thanks
You can create IntentFilter objects programmatically, and they can filter on URI schema among other things... much more control.
I thought subclassing IntentFilter would give you event more, but they made all the variations on "match" final so you can't override them in a subclass. Bah!
Eurika!
You can specify a data "scheme" instead of a mimetype. Just ask for "http" and "https" (in separate intent filters?).
<intent-filter>
...
<data android:scheme="http"/>
</intent-filter>
I am trying to set my application what will be a tool to edit pictures, to the menu in the gallery app of the android phone. I know it should go with the intent-filter but I can not get it to work.
<activity android:name=".Compass" android:label="#string/main_compass_tool_button">
<intent-filter android:label= "#string/main_compass_tool_button">
<action android:name="android.intent.action.SHARE"/>
<data android:mimeType="image/*"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
The reason it is not working is because the action should be
android.intent.action.SEND
Not
android.intent.action.SHARE
I've mixed up the two also. SHARE is what you are supposed to show in the interface when sending a SEND intent - there is no SHARE intent.