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
Related
I have noticed that when someone shares a location in WhatsApp using WhatsApp location share feature, tapping on the location opens up application chooser which included both GMAP and Uber. Initially, it looked like it was something like the "ACTION_VIEW" intent with a "geo:" scheme. I am trying to make my Android app handle the "ACTION_VIEW" intent with a "geo:" scheme, but tapping on the location in WhatsApp is not working as expected. Here is my code in the AndroidManifest.xml file:
<activity
android:name=".MapActivity">
<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:scheme="geo"
android:host="*"/>
</intent-filter>
</activity>
When I tap on a location shared from WhatsApp, the Android system is not showing my app as an option in the app chooser. I have checked that my app is installed and that the activity is declared in the manifest file.
What could be the reason for the intent filter not working as expected, and how can I fix it? Does WhatsApp use any other type of DeepLink for this? When hovering or clicking the location from a PC, it redirects to https://maps.google.com/maps?q=23.7797847%2C90.4065005&z=17&hl=en
I was using similar intent filters. The main difference is that host is not specified. As I remember * in host should be used to match subdomains.
<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:scheme="geo"/>
</intent-filter>
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 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 to open my android application, when user clicks on a link that has my domain name. For example, lets say my domain is abc.com and i have posted this link on my Facebook page. When one of my friend(who has my application installed in his device) clicks on the link(in the device's browser), i should be able to open my website in a webview inside my application.
I am not sure how to get this work, but will intent-filters work? If so, can someone give me a piece of code to start with?
You have to define a custom Intent Filter in the activity that should be launched when the url is clicked.
Let say that you want to launch the FirstActivity when a user click a http://www.example.com/ link on a web page.
Add this to your activity in the Manifest :
<activity android:name=".FirstActivity"
android:label="FirstActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.example.com" android:scheme="http"></data>
</intent-filter>
</activity>
When the user will click a HTML link to http://www.example.com/, the system will prompt either to use the browser or your app.
You can achieve this by using URI schemes (link e.g. myscheme://open/chat), add into your manifest this filter into e.g. main activity section (set your scheme name):
<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:scheme="YOUR_SCHEME_NAME" />
</intent-filter>
In your activity where you've set filter, you can get URI by calling this (in onCreate):
Uri intentUri = getIntent().getData();
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.