Return of default sms app android isn't returning Messages

1k Views Asked by At

Here's my code:

Intent i = (new Intent(Intent.ACTION_SEND, Uri.fromParts("sms", "12345678", null)));
PackageManager pm = getApplicationContext().getPackageManager();
final ResolveInfo mInfo = pm.resolveActivity(i, PackageManager.MATCH_DEFAULT_ONLY);
Log.i(TAG, "apk:"+mInfo.activityInfo.packageName);

I get back:

apk:com.mysms.android.sms

No matter what the default app is.

If I go into settings and switch the default app to messages, I never get back com.android.sms (or whatever messages package is). I specifically need the default message app in the form of com.whatever.its.name.


UPDATE: I gave up too soon! In case anyone else is interested in this, this worked for me:

String defApp = Settings.Secure.getString(getContentResolver(), "sms_default_application");
PackageManager pm = getApplicationContext().getPackageManager();
Intent iIntent = pm.getLaunchIntentForPackage(defApp);
ResolveInfo mInfo = pm.resolveActivity(iIntent,0);
Log.i(TAG, "apk:"+mInfo.activityInfo.packageName);
0

There are 0 best solutions below