Scheme小测

App之间的跳转

清单文件声明

        <intent-filter>
                <data
                    android:host="myhost"
                    android:scheme="myscheme" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

进行跳转

Uri uri = Uri.parse("myscheme://myhost");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

从网页打开APP

随便新建个txt文档,加入下面这句话

<a href='myscheme://myhost'>点击跳转到App</a>

然后把txt文档后缀名改成html,接着在手机端打开这个网页,就能看到下面的效果
这里写图片描述

猜你喜欢

转载自blog.csdn.net/weixin_37418246/article/details/82454276