我正在尝试获取单击以打开应用程序的 URL。我只是找不到从哪里可以获得这些信息。我有一个清单,单击时会打开应用程序。链接将是““我试图将其交给应用程序来处理。
<intent-filter>
<data android:scheme="http"
android:host="host.com"
android:pathPrefix="/file.html" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
EDIT
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Intent intent = getIntent();
Uri uri = intent.getData();
try {
url = new URL(uri.getScheme(), uri.getHost(), uri.getPath());
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
您应该能够通过以下方式获取活动中的意图数据:
Uri uri = this.getIntent().getData();
URL url = new URL(uri.getScheme(), uri.getHost(), uri.getPath());
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)