Android 4.4 installs sms app by default without user confirmation
Is it possible to change the default sms app to Android 4.4 without any knowledge? I am trying to do this on a ROOTED Galaxy S5 using reflection and system call methods, so this is what I have done so far:
Created a small app that implements everything that the app needs to be an SMS manager (according to http://android-developers.blogspot.in/2013/10/getting-your-sms-apps-ready-for-kitkat.html ) and I can make it the default sms, but Android asks me to confirm this in a dialog box. Now I am researching Android source code and found something in this class:
So, I'm trying to call an inner method:
SmsApplication.setDefaultApplication(mNewSmsApplicationData.mPackageName, this);
through reflection, and this is how I have done it so far:
Class[] params = new Class[2];
params[0]=String.class;
params[1]=Context.class;
Class cls = null;
try {
cls = Class.forName("com.android.internal.telephony.SmsApplication");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Method method = null;
try {
method = cls.getDeclaredMethod("getSmsApplicationData", params);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
try {
Object[] params2 = new Object[2];
params2[0]=getPackageName();
params2[1]=getApplicationContext();
Log.d("Current package", getPackageName());
method.invoke(null, params2);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
And I made this app for system apps and put it in / system / private app folder, rebooted my phone and started successfully with adb, but when I click the button that executes the code above, nothing happens. No errors, no log output, but the default application is still Messaging (com.android.mms).
Is there a way to do this?
source to share
This information is contained in the file /data/system/users/0/settings_secure.xml
. For example, the default SMS app saved with a key sms_default_application
.
<setting id="85" name="sms_default_application" value="com.google.android.talk" package="com.android.settings" />
You can find more information in this class: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/provider/Settings.java#6067
Accordingly, if you have ROOT permissions, you can edit this file.
source to share