Android Question No activity found to handle SEND_MSG (MMS) Intent

beni_feld

Member
Licensed User
Longtime User
I tried NJDude's Code sample and received the following error message:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND_MSG typ=image/png flg=0x20000 (has extras) }

Code: Copy
Dim iIntent AsIntent
iIntent.Initialize("android.intent.action.SEND_MSG", "")
iIntent.setType("vnd.android-dir/mms-sms")
iIntent.PutExtra("android.intent.extra.STREAM", CreateUri("file://" & File.Combine(File.DirDefaultExternal, "exiticon.png")))
iIntent.PutExtra("sms_body", "Hello there!!!")
iIntent.PutExtra("address", "1234")
iIntent.SetType("image/png")StartActivity(iIntent)
 
Sub CreateUri(uri AsString) AsObject
 Dim r AsReflector
Return r.RunStaticMethod("android.net.Uri", "parse", ArrayAsObject(uri), ArrayAsString("java.lang.String"))
 End Sub
I would appreciate your help.
 
Would you please post your AndroidManifest.xml that shows how composeMessageActivity is inserted??

Line was added to the code and not Manifest.
Code: Copy
Dim iIntent AsIntent
iIntent.Initialize("android.intent.action.SEND_MSG", "")
iIntent.SetComponent("com.android.mms/.ui.ComposeMessageActivity")
..........
..........

Worked well on Samsung android 2.3.6 (Except attchment) but Failed on Samsung android 4.2.2



BN
 
Upvote 0
Right. In their new-to-coding worldview, Google/Android still haven't figured out backwards compatibility. Instead of adding a new Messaging app (and leaving the old one in place), they deleted the old and changed the name of the new Messaging app/class, breaking backwards compatibility with all SMS apps that worked on earlier Android OS versions such as the 2.x series.

So for Android 4.x(also works for 2.x), you've got to do this to send an MMS:

B4A code
Code: Copy
            iIntent.Initialize("android.intent.action.SEND", "")
            iIntent.setType("vnd.android-dir/mms-sms")
            iIntent.PutExtra("android.intent.extra.STREAM", CreateUri_Click("file://" & File.Combine(Dir, Filename)))
            iIntent.PutExtra("sms_body", Message)
            iIntent.PutExtra("address", PhoneNumber)
            iIntent.SetType("image/png")
            'iIntent.SetComponent("com.android.mms/.ui.ComposeMessageActivity")
            iIntent.SetComponent(".ComposeSmsActivity")
            StartActivity(iIntent)


AndroidManifest.xml code:
Code: Copy
AddActivityText(Main,
        <!-- Activity that allows the user to send new SMS/MMS messages -->
        <activity android:name=".ComposeSmsActivity" >
            <intent-filter>
                <action android:name="android.intent.action.SEND" />             
                <action android:name="android.intent.action.SENDTO" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>
        </activity>)
[/quote]
 
Upvote 0
The attached code sample creates an Email instead of MMS (On my Samsung Android 4.2.2 and 2.3.6).

BN
It will normally pop up Android's application choice menu, but if you've already set a Default app to "Always" handle all of your picture attachments via email on your particular phone, then it will route it through your email instead of through MMS.
 
Upvote 0
Back
Top