I am unable to get the app I have written to launch when a certain url is passed back to the browser.
When the user launches the default browser and goes to the where my server is running for example: www.test.com, a list of films and books are displayed on the remote server. When the user selects one of these items i.e. a film or book - the server sends back a url that starts with bb:// and contains the uri link.fil?data=1. So the url looks like this when sent back from the server:
bb://link.fil?data=1
Currently I have the manifest which declares the following filter intent:
<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="bb"
android:host="test.com"
android:path="/.*"
android:pathPattern="/.*\\.*"/>
/>
<data
android:scheme="bb"
android:host="www.test.com"
android:path="/.*"
android:pathPattern="/.*\\.*"
/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
What I am trying to make happen is when the user selects a book of film the returning url launches my app.
After following many of the examples on line I still don't seem to be able to get this to work, and would appreciate any help you can provide.
<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" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="link.fil"
android:scheme="bb" />
</intent-filter>
The issue lay with chrome and mozilla they were rejecting the invocation - when using the default browser on android the app was called from the browser as was required. So I am marking the previous answer as correct but the problem lies with iframe which chrome and mozzila are now using- Maybe some one has the answer for fixing these exceptions?
Related
Right now in my manifest code I have
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter
android:autoVerify="true"
android:label="#string/app_name" >
<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" />
<data android:scheme="http" />
<data
android:name="default-url"
android:host="#string/bc"
android:scheme="#string/bc" />
</intent-filter>
which allow the user to get open with dialog if he click on URL that start with domain of my application for example: pop-up dialog to select the app
and its working fine, however, I'm facing an issue when the user request forgets password he receives a link on his email to reset his password.
the link he received is like this: www.domain.com/forget_password/email.
what I want is to keep the app link working but if the domain contains /forget_password open the browser by default, not the application.
Sorry, there is no "exclude" logic in <intent-filter>. You cannot create an <intent-filter> that says "I accept everything except this".
You will need to handle the forget_password path in your app, perhaps by launching a Web browser yourself.
I know this question may appear duplicated with some other similar questions. I've reviewed all of them and still can't fix this issue.
I want to launch my android app when clicking a link on a webpage. It works as desired when I use a custom Scheme:
<!-- In the deployed webpage: -->
Launch application
<!-- The Intent filter: -->
<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:scheme="test" android:host="test.com" />
</intent-filter>
But when changing the scheme to "https":
<!-- In the deployed webpage: -->
Launch application
<!-- The Intent filter: -->
<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:scheme="https" android:host="test.com"/>
</intent-filter>
the browser attempts to open the (nonexistent) page and ignores the intent filter.
It does not work for http, https, ftp, etc.
I'm running the app on Android 6.0, compiling: Minimum 11, target 23.
It seems like some mechanism is not allowing me to use the "reserved" schemes to launch an app, but I've not seen anything related to this in the posts.
Do you have any clue on what could it be?
Beginning with Android Marshmallow there's a new android:autoVerify flag you can use to request Android to verify that a certain domain belongs to you and that you want links to open in your app and not the browser.
"Android 6.0 (API level 23) and higher allow an app to designate
itself as the default handler of a given type of link"
See: https://developer.android.com/training/app-links/index.html#intent-handler
Try joining the two data tags like so and removing the first android.intent.category.DEFAULT category as its not needed on the first intent-filter at all, but necessary on the 2nd so that "the activity should be an option for the default action to perform on a piece of data"
<activity android:name=".MainActivity">
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https" android:host="test.com" />
</intent-filter>
</activity>
I am trying to intercept my own app's URL on android so that the user can open the URL in the app rather than on the browser. (I don't have browser support yet).
This is what I'm doing
<activity android:name=".ui.activity.MainActivity" android:label="#string/app_name">
<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.PICK_ACTIVITY" />
<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" />
<data android:host="myapp.com" />
<data android:pathPattern=".*"/>
</intent-filter>
</activity>
For some reason anytime I open myapp.com it still keeps opening in the browser, without giving me the option to open the URL in my app. I am trying this on my emulator with API 16 running on it. I've closed the emulator several times and started it again but still its the same behavior.
To avoid any errors in the URL of my personal app. I even experimented with:
<data android:host="goo.gl" android:scheme="http" />
<data android:host="goo.gl" android:scheme="https" />
The app DOES intercept the above url but ONLY the first time. If I click 'JUST ONCE' in the options presented, I don't get the option ever again until I restart the emulator.
Has anyone gone through this? What might I be doing wrong?
this answer helped me : link to question
if you add the package name to the intent, it will open your app by default
I want to launch my application from web browser in Android using Intent-Filter based on scheme, host in the DATA tag like this.
<activity android:name=".activity.LogoActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.phone.MainActivityPhone" android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<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="my" android:host="mystore" />
</intent-filter>
</activity>
<activity android:name=".activity.tablet.MainActivityTablet" android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<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="my" android:host="mystore" />
</intent-filter>
</activity>
As you see, There are two Main Activities for phone and tablet, and in LogoActivity determine which Main Activity will be opened by screen size. But the problem is when user clicks my://mystore link in web browser, there are two choices to launch that MainActivtyPhone and MainActivityTablet.
What I want is there is only one proper intent-filter works for uri my://mystore .
Any help? Thanks.
On the first run of your application, use PackageManager to disable the activity you do not want to use.
Please do not invent custom schemes. Please use HTTP URLs instead:
<data android:scheme="http" android:host="yourdomain.com" android:path="/something/or/another" />
That way, you can actually put a real Web page at http://yourdomain.com/something/or/another, so if somebody gets your link but does not have your app installed, they will see your Web page, instead of getting an error.
Also, please remove android:configChanges, or handle all configuration changes.
There are many answers in stackoverflow showing how to lauch app from a web browser ,but I am not sure what went wrong with my code, that never seems to be doing the intended.
I am trying to launch my app by a URL from any other app like web browser,initially
my manifest file looks like this
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
And When I typed http://ebay.com in the browser that never started my app.Obviously,how does the browser know about my app?,then i tried the other way around and added another Activity called MyActivity and altered the manifest file as
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MyActivity">
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
and tried in my Main Activity
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://mycityway.com")));
Thus producing the intended result.I can also start another application Activity using this method.
But most of the answers here says that the later is possible.What is the mistake i am doing,I couldn't launch my app from browser.Please guide me.
And When I typed http://ebay.com in the browser that never started my
app.
It gets started when a matching link is clicked not when you type the url in the browser.
Try it by sending yourself an email containing http://ebay.com and click the link in the email application.