Android 打开另一个APP,并传参

1、在待打开的APP注册可被外APP调用的activity

<activity android:name=".TwoActivity">
    <intent-filter >
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:scheme="test"
            android:host="com.example.mvvmtest"
            android:path="/home" />
    </intent-filter>
</activity>

注:host是包名

2、任意APP打开已注册的开放的activity

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("test://com.example.mvvmtest/home"));
intent.putExtra("name","aacc44");
startActivity(intent);
发布了339 篇原创文章 · 获赞 66 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/meixi_android/article/details/103493198