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);