现在我有'ITV'和'Launcher'两个Apk。
ITV想拿到Launcher中的数据。
ITV想拿到Launcher中的数据。
可以利用android:shareduserid。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.galaxyitv.launcher"
android:versionCode="3"
android:versionName="3.1"
android:sharedUserId="Cut.Movie"
>
只要两个Apk都是用了同一个shareduserid。并且签名文件相同。它们在Linux下用的就是同一个用户ID,运行在同一个进程或虚拟机中。
然后我在ITV的activity中通过
Context LaunchContext = this.createPackageContext("com.galaxyitv.launcher", Context.CONTEXT_IGNORE_SECURITY);
拿到Launcher Apk的context对象,其余的操作文件、数据库就随你了。