this whole subject took some precious time from my life, and still isn't 100% solved, hope i could find some answers here.
EXPECTED RESULT: when tapping a link to my app (http://www.myapp.com), if app is installed, os should open a dialog where user chooses the app to open this link (my app or browser), if app isn't installed should normally browse this url with the browser.
ACTUAL RESULT:
on Samsung devices, tapping the link (http://www.myapp.com) gives the expected result, a dialog opens prompting me to choose an app to open this with, including my app.
on Nexus devices, on the other hand, it acts like the app isn't installed, and it just browses the url with the browser with no prompting to choose an app to open.
How to get Nexus devices to support this flow as well? like Samsung devices?
this is how i registered the activity in my app manifest:
<activity
android:name=".activities.MainActivity2"
android:configChanges="keyboardHidden|screenSize"
android:theme="#style/application_theme_header_green">
<intent-filter >
<data android:scheme="http" android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
hope i provided all needed info.
thanks all.
Try replacing
<data android:scheme="http" android:host="www.myapp.com" />
With
<data android:scheme="http" />
<data android:host="www.myapp.com" />
This looks like the only difference between what I have and what you've posted, and it works on Nexus devices.
Related
How can I control the default Open supported links to either Ask every time or Open in this app for my Android app? Does it happen in the manifest?
I have two apps that try to accept the same universal link scheme, and the ideal behavior is to have the user decide which app to open when they click on the link. However, it seems that the first app correctly has the Open supported links in settings set to Ask every time, while the other app has the Open supported links as Open in this app. Thus, when both apps are installed, only the second one will be opened straight away, whereas the first one won't even be prompted.
The portion that accepts universal links in both of the AndroidManifest.xml files are almost identical.
<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="foo.bar.com" android:pathPrefix="/action/" android:scheme="https" />
</intent-filter>
My objective is to open my android application when user clicks link e.g I have shared specific item link (http://example.com/api_shirts.php?utmsource=shirt98) then if user have already installed my application then open it else where open it on browser.
I have searched a lot and get this but it's not working for me
<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="http"
android:host="www.example.com" />
<data android:scheme="https"
android:host="www.example.com"/>
</intent-filter>
I'm not sure if you may need to set a pathPrefix on this case. Also, the OS may open other prefered app that the user has set up as default app for that schema.
If I remember correcly you have to associate your app with your website so the OS can open the app directly bypassing the user's choice:
https://developer.android.com/studio/write/app-link-indexing.html#associatesite
Also, check https://developer.android.com/training/app-links/verify-site-associations.html to read about "deep links" vs "app links". You need app links for what you are trying to do.
So I have an app with deep linking that can open links from the company website.
I do this by adding an intent-filter to an Activity tag like so:
<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="*.company.com"
android:scheme="https" />
</intent-filter>
The problem is that the website has multiple subdomains that each trigger the app chooser. (category1.company.com, category2.company.com etc)
If it were using only one domain, the app chooser would appear only once when opening the main page, the user would choose to continue in the browser "just once" and navigate the website without interruption.
With subdomains, each time the user navigates to a different subdomain he sees the app chooser and has to click "just once" again.
Is there any way to configure the app to display the app chooser only the first time you go on that domain and not for each subdomain?
Have you try several data block in the same intent filter
<data
android:host="category1.company.com"
android:scheme="https" />
<data
android:host="category2.company.com"
android:scheme="https" />
....
use app-ink instead, so android will not ask and just open your app.
you can use a wildcard since Android 6 to include all subdomains.
https://developer.android.com/training/app-links
scenario:
i get an sms with link like this https://www.xyz.com. once i click on the link it opens a browser and if the app exists on my device [given it has the above link in its data scheme] like below
</intent-filter>
<intent-filter android:priority="100">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="www.xyx.com" />
</intent-filter>
when ever the browser opens the https://www.xyz.com the app is opened.
problem:
this works perfect in emulator. i believe it does in nexus devices too.
but, i tried on htc one x and samsung s3 ... it didnt work.
even the app is present the browser opens the webpage.
is it something the manufacturer done to the OS. theoretically it works in emulators.
now i am worried to publish the app since. most of the devices out there are samsung's htc's etc..,
should i use mime return from that page type now?
is there something i am missing?
I've seen this question asked 100+ times but none of the answers are working for me. I want my app to handle all files with ics or vcs extensions, *no matter where they come from. *Except, I don't want to have to download them myself if they come from http/https, I just want the browser to at least let the user save them and then open with my app. Currently the browser says "content not supported on this phone".
Here is what I currently have, but I've been trying everything:
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="*" />
<date android:mimeType="text/calendar" />
<data android:scheme="https" />
</intent-filter>
With the above, when I click an https link, one that comes from my server and I know my server is sending the text/calendar mime-type, the droid asks what app they want to use to open the link. The list has my app or the browser. If I select my app, it runs my activity and gives me the Uri. I want the browser to download the file though, I don't want to have to download it myself... same way other file types work, images, pdfs, etc. If I select the browser, it starts the download but then stops with a "content not supported on this phone" error.
I also tried this:
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="*" />
<data android:scheme="file" />
<data android:pathPattern=".*\\.ics" />
</intent-filter>
Also tried with the scheme set to "content", and lots of other variations I found on SO and other places.
You should consider that the browsers are implementing this download behavior for binary files and you can not change it by a intent-filter.
Other applications like pdf viewer declare an intent-filter identical to your second approach (except for the file-extension).
Therefore I would recommend to just download the file yourself. As it just requires a few lines of code this should not be a big problem.