Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open android app from link

I know about the universal linking but that's not the thing I want to do. With universal links, I have to define some url schema and when I try to open it in the browser (click on a link that points to that url) it will ask me if I want to open the application. Please correct me if that's not true.. I want to open the application just via app-name:{data goes here} or just simply app-name: (app-name is a name that I want to define somewhere). Not sure how this linking is called? Now I can open the app but via different name and not sure where it is defined. Tried to change the package name because I thought it's autogenerated from there but without success. The application is written in Cordova and maybe there are some limitations, I don't know. But it would be nice if I knew this kind of linking name! Of course, if you can provide some more information on how this can be achieved with Cordova - awesome!

like image 757
kirpt Avatar asked Oct 24 '25 10:10

kirpt


2 Answers

If you want to open one app from another app just use this

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.anotherapp");
if (launchIntent != null) { 
    startActivity(launchIntent);//null pointer check in case package name was not found
}

If you want open from some web url u need this ,its called "deep linking" read this https://developer.android.com/training/app-links/deep-linking

 <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.my.app.com"
        android:path="launch"
        android:scheme="http"></data>
</intent-filter>
With the email link set as http://www.my.app.com/launch.

If u need to open your app page from webView in your app u just can create new WebViewClient extended from WebViewClient and handle your url there

like image 151
L.Petrosyan Avatar answered Oct 25 '25 23:10

L.Petrosyan


I use this plugin (https://github.com/EddyVerbruggen/Custom-URL-scheme) for open my apps with something like that :

<a href="myapps://" />

OR

<a href="myapps://forgotpassw" />

I hope that can help you

like image 35
Enzo B. Avatar answered Oct 26 '25 01:10

Enzo B.