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.
Related
I want to open my app from browser, when user opens any link that my app handles. So I'm using deeplinking. Here's my code in manifest file.
<activity
android:name=".ColorCaptureActivity"
android:label="#string/title_activity_color_capture"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter android:label="DeepLink">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http"
android:host="www.somelink.com"/>
</intent-filter>
</activity>
Everything fine, but when I click on the link, android shows intent chooser, where displayed all apps that can handle this intent. I understand it's the default behaviour, but is there a way to not show the chooser popup and open my app directly?
Try implementing App Links to set your application as the default handler for the links.
Refer: https://developer.android.com/training/app-links#app-links-vs-deep-links
I don't know if it's really understandable.
When i'm clicking on a llink in a mail, I can open this link with my application and that's perfeclty what I want.
<intent-filter>
<data android:scheme="https" android:host="xxx.xxx.com"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
BUT
When i'm opening my application like that, and I check the opened application, I see that my application is "inside" Gmail task, like that
But, when i'm opening the link with Chrome for exemple, Chrome is opening in his own task, like that
How can my application open in her own task and NOT inside Gmail's one ?
you have to set a specific andorid:launchMode to your activity:
android:launchMode="singleTask"
or
android:launchMode="singleInstance"
placed in the declaration of your activity in the AndroidManifest.xml will do it.
take a look also at this article that explain how android handles tasks and activities
I have added my app option in share via option that comes when we share any image in gallery through share via option. I am able to see my app in share via option. But the problem is once the image is shared and after that the gallery is opened then the gallery still shows the app activity which means gallery activity is not finished even after sharing the image. How to overcome this problem ?
Here is the line of code I've added in activity tag in Manifest file :
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
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
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.