here i try to put key value setResult in "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();
}
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
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
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