Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open specific app based on URL

I will like to open an app if the url

for example if the person opens : http://www.example.com/id=100, i would like to parse example.com and show options to open it with my app.

The same functionality is used by youtube, if you click on youtube link it will either ask if you would like to open it using youtube or directly play youtube video

like image 273
Meghal Shah Avatar asked Jan 30 '13 05:01

Meghal Shah


People also ask

How do I redirect a URL to the app?

Once you build a link with same signature as mentioned in manifest The android system will add your app in chooser to open link in your app and you will get the data in "getIntent(). getData()" in respective Activity. If app is not installed the link will itself open in browser. Then handle it on browser .

How do I open Windows app from URL?

You have to designate custom protocol name unused by any other app like for example "myapp". Then bind your application to this protocol. Then url like myapp://myname.com/users/edit/5 will open your application (and pass the URL to the application for further processing).


2 Answers

You can add a data specification to your intent filter with the http schema and the domain you want to open with your app.

<intent-filter ... >
    <data android:scheme="http" android:host="example.com" />
    ...
</intent-filter>
like image 198
rekire Avatar answered Nov 03 '22 01:11

rekire


Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);
like image 21
Nirav Ranpara Avatar answered Nov 03 '22 00:11

Nirav Ranpara