简体   繁体   中英

How do I link to my Android app on device?

I am using a url to redirect my app to facebook. One of the parameters for this is a url for redirection after the action is completed, which is where I need a link back to my app. I simply want it to go back to the app and wake it up again. Also it would be nice if this link could be used elsewhere, and would link to the play store if the application is not already installed or if it is clicked on using a desktop.

Thanks in advance, this will help me out a lot!

Take a look at the App Links protocol. One implementation is in Bolts .

EDIT: A bit more info... you could use a private URL scheme (yourapp://), but there is controversy over that because schemes are supposed to be universal, and "yourapp" is not. Also, the idea of linking to the play store if the app is not installed would not work.

App links works by embedding meta data into a web page, or by standardizing the OS-specific API used to launch an app (Intents, on Android). There is a further extension implemented by Facebook called App Link Hosting, which hosts the info on FB.

you can refer to any app in the play store with:

             String uri = "market://details?id=" + pkgName;

where pkgName is the name of your app's package ie "com.android.example" You can start an activity that way as well

         Intent intent = new Intent(Intent.ACTION_VIEW);
         String uri = "market://details?id=" + pkgName;
         intent.setData(Uri.parse(uri));
         startActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM