[英]How do I link to my Android app on device?
I am using a url to redirect my app to facebook. 我正在使用URL将我的应用重定向到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. 如果此链接可以在其他地方使用,并且如果尚未安装该应用程序或者使用桌面单击该应用程序,则可以链接到Play商店。
Thanks in advance, this will help me out a lot! 在此先感谢您,这对我有很大帮助!
Take a look at the App Links protocol. 看一下App Links协议。 One implementation is in Bolts . 一种实现是在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. 编辑:更多信息...您可以使用私有URL方案(yourapp://),但是由于该方案应该是通用的而存在争议,而“ yourapp”不是。 Also, the idea of linking to the play store if the app is not installed would not work. 此外,如果未安装应用程序,则链接到Play商店的想法不起作用。
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). 应用程序链接的工作方式是将元数据嵌入到网页中,或者通过标准化用于启动应用程序的特定于操作系统的API(在Android上使用Intents)。 There is a further extension implemented by Facebook called App Link Hosting, which hosts the info on FB. Facebook 还实现了名为App Link Hosting的扩展 ,该扩展在FB上托管信息。
you can refer to any app in the play store with: 您可以通过以下方式引用Play商店中的任何应用:
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 其中pkgName是应用程序包的名称,即“ com.android.example”。您也可以通过这种方式启动活动
Intent intent = new Intent(Intent.ACTION_VIEW);
String uri = "market://details?id=" + pkgName;
intent.setData(Uri.parse(uri));
startActivity(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.