Domanda

Is there any way to send SMS text messages on BlackBerry 10 using the Android SDK, since according to BlackBerry documentation for Android apps SMSManager and SMSMessage hardware features are not supported?

È stato utile?

Soluzione

It appears that this only works on Dev Alpha devices running 10.9.10.35 or later. The following intent to launches the standard messaging app, including a target phone number and body text:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("vnd.android-dir/mms-sms");
intent.putExtra("address", adress);
intent.putExtra("sms_body", text);
startActivityForResult(intent, 0);

The documentation seems to suggest that this is disallowed, but nevertheless it works:

Android applications cannot provide system-wide services to the rest of the device. E.g:

  • Dialing services (handling android.intent.action.ACTION_DIAL)
  • Viewing capabilities (system-wide handing of android.intent.action.ACTION_VIEW)
  • Data sharing capabilities (android.intent.action.ACTION_SEND)

I discovered the native package name that handles the intent by querying the components that accepts it, which revealed:

com.rim.messaging.NativeSmsMms

Sure enough, launching it works as expected:

Intent intent = new Intent();
intent.setComponent(new ComponentName(
        "com.rim.messaging",
        "com.rim.messaging.NativeSmsMms"));
startActivityForResult(intent, 0);

Beware that the Android version is not present and hence the following intent will not work:

Intent intent = new Intent();
intent.setComponent(new ComponentName(
        "com.android.mms",
        "com.android.mms.ui.ComposeMessageActivity"));
startActivityForResult(intent, 0);

I initially thought this wasn't possible after testing on our Dev Alpha device, but evidently it was originally shipped without the Text Messages app. Go figure.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top