0
点赞
收藏
分享

微信扫一扫

android使用Scheme进行唤起三方app

迎月兮 2024-10-10 阅读 1

Aapp唤起Bapp

Aapp

Intent intent =new Intent(Intent.ACTION_VIEW,
Uri.parse(“myapp://cb”));//输入你们协定的Scheme
//intent.putExtra(“code”, code);可以传参
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//如果是唤起三方app,加入次方法,如果是在Aapp直接打开三方页面则不需要次方法
// 启动目标应用
startActivity(intent);

Bapp

首先在manifest.xml中加入

<activity

android:name="接收的activity"

android:screenOrientation="portrait"

android:exported="true"

android:theme="@style/SplashAppTheme">

然后在你接收的activity中处理


Intent routerIntent = getIntent();

Uri intentUri = routerIntent.getData();

//如果是三方进入

if (Intent.ACTION_VIEW.equals(routerIntent.getAction())) {

//在里面处理你想处理的就可以了

}

举报

相关推荐

0 条评论