在这里,我尝试将键值 setResult 放在“android.telephony.TelephonyManager”中
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
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();
}
但是在将随机imei放入editText并单击按钮btn_imei后,它会在Sharepreference中创建键“imei_val1”和值“我在editText中写入”,但XSharePreference不能采用我从Sharepreference中输入的随机键值