5

我想打开一个应用程序,如果 url

例如,如果该人打开:http://www.example.com/id=100,我想解析example.com并显示选项以使用我的应用程序打开它。

youtube 使用相同的功能,如果您单击 youtube 链接,它会询问您是否要使用 youtube 打开它或直接播放 youtube 视频

4

2 回答 2

7

您可以data specification使用 http 架构和要使用您的应用打开的域向您的意图过滤器添加一个。

<intent-filter ... >
    <data android:scheme="http" android:host="example.com" />
    ...
</intent-filter>
于 2013-01-30T05:32:52.670 回答
1
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);
于 2013-01-30T05:34:05.423 回答