如何从网页打开android应用程序?

我可以从HTML调用我的应用程序吗?

例如:我可以从我的应用程序正确调用网页的代码。

android代码:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "myDomain.com"))); 

并在我的网站做了一些事情后,我想再次打开我的Android应用程序。

我find这个代码,

 <a href="market://details?id=info.androidhive.slidingmenu"> 

但它只是叫市场来find并安装应用程序!

你可能会看看这个: https : //developer.android.com/training/app-indexing/deep-linking.html

 <activity android:name="com.example.android.GizmosActivity" android:label="@string/title_gizmos" > <intent-filter android:label="@string/filter_title_viewgizmos"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Accepts URIs that begin with "http://www.example.com/gizmos” --> <data android:scheme="http" android:host="www.example.com" android:pathPrefix="/gizmos" /> <!-- note that the leading "/" is required for pathPrefix--> <!-- Accepts URIs that begin with "example://gizmos” <data android:scheme="example" android:host="gizmos" /> --> </intent-filter> 

所以你的应用程序将通过这个链接开始:

 <a href="example://gizmos"> 

Android Chrome 25的链接已经不再可能了

对于iOS,你可以阅读这个问题

对于iOS,你可以设置URLSchemes,如果在浏览器上input的话就会启动应用程序:例如,如果你的应用程序叫做market

市场:/ /将启动应用程序

在info选项卡中添加URLScheme: 在这里输入图像说明

你可以通过实现application:willFinishLaunchingWithOptions:application:didFinishLaunchingWithOptions:方法来处理url选项。

您可以通过在网站中添加一个小脚本并在代码中进行一些更改来实现。 你必须做url计划。