I am trying to set up a filter for URLs specific to my domain and a certain subdomain. This is what I have so far:
<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="https" android:host="www.mywebsite.com" android:pathPattern="/mysubdir/id=*"/>
</intent-filter>
I tried it without the host (only pathPattern), with and without the first slash on pathPattern and every combination I thought of, but it always links my app to every https link I click. What is going on here?
Thanks in advance.
EDIT:
I realised that I should be using pathPattern=/mysubdir/id=.* , but even after this change, nothing happens.
Related
I'm dealing with two problems here. This is my manifest:
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="www.example.com" android:pathPrefix="/test/" android:scheme="https" />
<data android:scheme="myapp" />
First of , I't redirect to my application when I type inside Chrome's
URL. If I click on a link "https:www.example.com/test/kakaka" inside
an SMS, it shows if I want to open my application as expected. But,
if I paste this link inside Chrome URL place and go, it does nothing.
Second problem: Okay, so I decided to test with my custom scheme. I
put on Chrome's URL "myapp://open" and it should work, right? But it
doesn't. So, I removed the line <data
android:host="www.example.com"..... and myapp:// WORKS! So, cant I
have more than 1 scheme in one activity?
When you put two <data> elements inside an <intent-filter> they are merged together. If you want two different specific urls, then create a second <intent-filter> with the second url scheme.
I have a little web app that sends anonymous messages as links.
I'm currently working on its Android version. The links of messages are in the pattern:
https://believe-labs.co/speak/m?somerandomkey
I want that when the receiver clicks the link of a message, and if the app is installed on the device, the browser should redirect the link to my app activity and launch it.
I tried
<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="believe-labs.co/m" android:scheme="https"/>
</intent-filter>
but it doesn't seem to work. Where am I wrong and what do I need to add?
You must use this kind of data (host & path):
<data
android:scheme="https"
android:host="believe-labs.co"
android:path="/speak/m" />
You shouldn't use believe-labs.co/m in the host,you can try the below code that will work for sure because i am also using same code in my app to be open via deeplink.
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data
android:host="believe-labs.co"
android:scheme="https"></data>
</intent-filter>
I want my app to execute when example.com is browsed to. No matter what I do, I cant make this happen. I've tried dozens of things listed in other questions.
Trying to troubleshoot, if I can get answers to these questions it will help a lot:
- Is there a certain permission I need to request in order to capture intents?
- Is there a way to query an app to see what intents it accepts? So I can test that my manifest is properly being set.
Here is the config I'm using which doesn't work:
<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="example.com"> </data>
<data android:scheme="https"></data>
<data android:scheme="http"></data>
<data android:pathPattern=".*"></data>
</intent-filter>
It's up to whatever app you're using to try to launch yours to use an intent that your application can handle. If you're in a browser, and you click on a link that a browser can handle, odds are the browser is just going to handle that link instead of making an intent to see if there are any other apps that can handle it.
Try sending a link to your email and opening from there instead. If you have set up everything correctly already, I bet you it'll ask whether you want to open your browser or your app.
Turns out you need two intent filters setup, or else it wont work. You also need everything wrapped in an 'activity' block, which I didn't have. Here's the updated XML that now works:
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.BROWSABLE"></category>
<category android:name="android.intent.category.DEFAULT"></category>
<data android:host="example.com"> </data>
<data android:scheme="https"></data>
<data android:scheme="http"></data>
<data android:pathPattern=".*"></data>
</intent-filter>
</activity>
If anyone understands why two intent-filters are needed would be great to know the explanation.
The following works fine:
I click on the link www.mycompany.com in an email and it starts my app:
<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="www.mycompany.com/download" android:scheme="http"/>
</intent-filter>
However, what I want to work is as below but it's not working:
I want to be able to restrict it to the link www.mycompany.com/download:
<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="www.mycompany.com/download" android:scheme="http" />
</intent-filter>
Why the distinction? I don't want to block my entire website with the app. I just want that specific domain to redirect to the app. How do I do that?
What you've shown is not a subdomain. That is,
www.mycompany.com/download
is not a subdomain of
www.mycompany.com
But you could use a subdomain to address this issue by setting up something like
download.mycompany.com
and have it map to www.mycompany.com/download. (Most servers allow you to set up subdomains like that.) You can then modify the intent filter accordingly.
EDIT
To support what you're trying to do without setting up a subdomain, you can do the following:
<data
android:host="www.mycompany.com"
android:scheme="http"
android:pathPrefix="download"
/>
I would suggest you to try latest feature made available by Google and that is App-indexing to show your app even when user search about your website on Google.
You need to go through 2 steps:
1 Sign Up for this feature here
2 Update your app as well as sitemap of your website as mentioned here
For further reference you can go through this documentation
Screenshot :
In Android, I am trying to make it so that the user downloads a font from the browser, and I am able to view the font when downloaded. After multiple issues, I still have one lingering one: Registering the filetype with the browser.
When trying to download with the Emulator (2.1-u1), I get "Cannot download. The content is not supported on this phone". Okay, so maybe its my manifest file. Updated with this:
<activity android:name=".MainActivity" android:label="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<catagory android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http"/>
<data android:scheme="https"/>
<data android:scheme="ftp"/>
<data android:host="*"/>
<data android:mimeType="*/*"/>
<data android:pathPattern=".*zip"/>
</intent-filter>
</activity>
Went back to the browser, and fails again. Restart the Emulator, still fails.
Note that I got this format from posts here.
Any suggestions on what to do?
Registering for a MIME type of */* and a host of * is rather impolite. You are attempting to handle every ZIP file from every Web site, whether it is a font or not.
Try an action of VIEW instead of MAIN.
<catagory android:name="android.intent.category.BROWSABLE"/>
The first word on that line, "catagory", should be "category". Maybe that typo is the cause of the problem.