1.系统权限
android:sharedUserId=“android.uid.system”
2.签名
通过手动签名的方式,用系统的签名文件为程序签名解决签名的问题,将程序加入到系统进程中。
3.通过反射切换系统语言
//调用
// changeSystemLanguage("zh", "CN");
public void changeSystemLanguage(String language,String country) {
//Locale mLocale = new Locale("en", "ZA");
Locale mLocale = new Locale(language, country);
try {
Class iActivityManager = Class.forName("android.app.IActivityManager");
Class activityManagerNative = Class.forName("android.app.ActivityManagerNative");
Method getDefault = activityManagerNative.getDeclaredMethod("getDefault");
Object objIActMag = getDefault.invoke(activityManagerNative);
Method getConfiguration = iActivityManager.getDeclaredMethod("getConfiguration");
Configuration config = (Configuration) getConfiguration.invoke(objIActMag);
config.locale = mLocale;
Class clzConfig = Class.forName("android.content.res.Configuration");
java.lang.reflect.Field userSetLocale = clzConfig.getField("userSetLocale");
userSetLocale.set(config, true);
Class[] clzParams = {Configuration.class};
Method updateConfiguration = iActivityManager.getDeclaredMethod("updateConfiguration", clzParams);
updateConfiguration.invoke(objIActMag, config);
BackupManager.dataChanged("com.android.providers.settings");
} catch (Exception e) {
e.printStackTrace();
}
}
5.各语言关键字
zh_CN en_AU en_IN fr_FR it_IT es_ES et_EE de_DE nl_NL cs_CZ pl_PL ja_JP
zh_TW en_US zh_HK ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR rm_CH sv_SE bg_BG
ca_ES en_GB fi_FI hi_IN hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA
vi_VN tl_PH ar_EG fa_IR th_TH sw_TZ ms_MY af_ZA zu_ZA am_ET hi_IN en_XA ar_XB fr_CA km_KH
lo_LA ne_NP si_LK mn_MN hy_AM az_AZ ka_GE my_MM mr_IN ml_IN is_IS mk_MK ky_KG eu_ES gl_ES
bn_BD ta_IN kn_IN te_IN uz_UZ ur_PK kk_KZ