Ard*_* ZM 6 android hyperlink web
如果应用程序安装在智能手机上,我需要知道如何在应用程序中打开Instagram页面.
一种简单的方法,例如www.instagram.com/example将您链接到浏览器页面,这不是我想要的.
我该如何实现这一目标?
从浏览器启动instagram.要启动Instagram表单链接,应该足以提供以下链接:
<a href="http://instagram.com/p/<picture id>">look at this instagram picture</a>
Run Code Online (Sandbox Code Playgroud)
<a href="http://instagram.com/p/0nUyKnMJw4">look at this instagram picture</a>
Run Code Online (Sandbox Code Playgroud)
尝试在Android设备上打开该链接.另外,请记住,必须在设备上安装instagram.对于用户,将"p"替换为"_u",将图片ID替换为用户名.
为什么会这样?Instagram应用程序具有http和https浏览的目标侦听器
<data android:host="instagram.com" android:pathPrefix="/p/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/p/" android:scheme="https"/>
<data android:host="instagram.com" android:pathPrefix="/_u/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/_u/" android:scheme="https"/>
<data android:host="instagram.com" android:pathPrefix="/_uid/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/_uid/" android:scheme="https"/>
<data android:host="instagram.com" android:pathPrefix="/_n/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/_n/" android:scheme="https"/>
Run Code Online (Sandbox Code Playgroud)
编辑:它有一个旧的清单文件.
它对我有用。
try {
// mediaLink is something like "https://instagram.com/p/6GgFE9JKzm/" or
// "https://instagram.com/_u/sembozdemir"
Uri uri = Uri.parse(mediaLink);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setPackage("com.instagram.android");
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.e(TAG, e.getMessage());
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
43221 次 |
| 最近记录: |