Alex161
Alex161

Reputation: 71

How to generate test MMS and pass it to Android emulator?

my Android application must handle various types MMS. Unfortunately, I have only basic knowledge about MMS, I know that MMS like email-massage, I know about SMIL-format. Know how parse it, something like

 ContentResolver contentResolver = getContentResolver();

But this is not enough to testing my application.
I need generate MMS various types, covered all MMS types (including MP3, various types of Video by reference and as included content) and then send generated MMS to my Android emulator to debug my application.
How I can make this?

Upvotes: 0

Views: 83

Answers (1)

Abhinay Gowda
Abhinay Gowda

Reputation: 378

I've created a comprehensive MMS test generator that will help you test various types of MMS messages. Here's how to use it:

  1. First, initialize the generator:

    MMSTestGenerator generator = new MMSTestGenerator(context);

2.Generate different types of test messages:

// Generate a text-only MMS

generator.generateTestMMS("1234567890", MMSType.TEXT_ONLY);

// Generate an MMS with text and image

generator.generateTestMMS("1234567890", MMSType.TEXT_AND_IMAGE);

// Generate an MMS with multiple media types

generator.generateTestMMS("1234567890", MMSType.MIXED_MEDIA);

To pass MMS to emulator. Make sure You add these permissions firstly:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />

In Your code initialize testtools, setup emulator and test MMS according to your type

MMSEmulatorTestTools testTools = new MMSEmulatorTestTools(context);//initialize test tools

Setup the emulator (do this once when starting your tests)

try {
    MMSEmulatorTestTools.setupEmulatorForMMS("5554");

*// Use your emulator's port*

} catch (IOException e) {
    e.printStackTrace();
}

Send test MMS messages with required type

testTools.sendTestMMSToEmulator("5554", MMSTestGenerator.MMSType.TEXT_AND_IMAGE);

Upvotes: 0

Related Questions