在4.4上是有效的,高版本不保证
存储端程序关键代码App1
SharedPreferences pref = getContext().getSharedPreferences("File", Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean("para", true);
editor.apply();
读取端程序关键代码App2
try {
Context app1Context = context.createPackageContext(App1_PACKAGE_NAME, Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences sh = app1Context .getSharedPreferences("File", Context.MODE_WORLD_READABLE | Context.MODE_MULTI_PROCESS);
sh.getBoolean("para", false);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}