问题描述
在这里我尝试将键值 setResult 放在android.telephony.TelephonyManager"中
here i try to put key value setResult in "android.telephony.TelephonyManager"
XposeHook.Class
XposeHook.Class
XposedHelpers.findAndHookMethod("android.telephony.TelephonyManager", lpparam.classLoader, "getDeviceId", TYPE, new XC_MethodHook() {
public void afterHookedMethod(MethodHookParam param) throws Throwable{
XSharedPreferences pref = new XSharedPreferences("com.yuvi.pirate", "user_prefs");
param.setResult(pref.getString("imei_val1", " "));
}
MainActivity.class
MainActivity.class
final SharedPreferences sharedpreferences = getSharedPreferences("user_prefs", 0);
btn_imei.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
SharedPreferences.Editor editor = sharedpreferences.edit();
String trim = edt_imei.getText().toString().trim();
editor.putString("imei_val1", trim);
editor.apply();
}
但是在editText中放置随机imei并单击按钮btn_imei后,它会创建密钥imei_val1";和值我在 editText 中写的";在 Sharepreference 中,但 XSharePreference 不能采用我从 Sharepreference 中放入的随机键值
but after put random imei in editText and click on button btn_imei it create key "imei_val1" and value "which i write in editText" in Sharepreference but XSharePreference can't take that random key value which i put from Sharepreference
推荐答案
它没有采用 Sharepreference 因为我们无法在 android SDK N (24) 之后读取 user_pref.xml 所以我们必须让 user_prefs.xml 世界可读!所以让 sharepreference worldReadable 并解决
its not taking Sharepreference coz we can't read user_pref.xml after android SDK N (24) SO we have to make user_prefs.xml world readable !! so make sharepreference worldReadable and its solved
你必须做的让世界可读的首选项可读只需进入 targetSdk 23 或更少,他们使用 Context.Mode_Worldreadable 现在 Xsharedpreference 读取你的 prfs 文件
what you have to do make preference readable for worldreadable just go in targetSdk 23 or less than and them use Context.Mode_Worldreadable and now Xsharedpreference read your prfs file
这篇关于我的 Xposed 模块无法从 SharePreference 获取键和值,但是当我将它放入 Xsharepreferences 时它可以工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!