send MMS with audio

All your problems with Audio, Video and Images.

send MMS with audio

Postby mrtoto1234 » Thu Jun 17, 2010 10:32 am

Hello,
I have a problem in my application. I have to send MMS with audio attachement.

If I do :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void sendMMS(Context aContext, String aFilePath) {
  2.                 Intent intent = new Intent("android.intent.action.SEND_MSG");
  3.  
  4.                 intent.putExtra("address", "aphonenumber");
  5.                 intent.putExtra("sms_body", "mybody");
  6.                
  7.                 Uri uri = Uri.fromFile(new File("/sdcard/myimage.jpg"));
  8.                 intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set previously
  9.                 intent.setType("image/jpeg");
  10.                
  11.                 aContext.startActivity(intent);
  12.  
  13.         }
  14.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4

It's work great. I can preview my MMS with an image in attachement.

But if I put audio file in attachement :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void sendMMS(Context aContext, String aFilePath) {
  2.                 Intent intent = new Intent("android.intent.action.SEND_MSG");
  3.                
  4.                 intent.putExtra("address", "aphonenumber");
  5.                 intent.putExtra("sms_body", "mybody");
  6.                 Uri uri = Uri.fromFile(new File("/sdcard/audiofile.amr"));
  7.                 intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set previously
  8.                 intent.setType("audio/amr");
  9.  
  10.                 aContext.startActivity(intent);
  11.         }
  12.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

It's didn't work...

I have a nice exception :
Syntax: [ Download ] [ Hide ]
  1. 06-17 11:29:44.608: DEBUG/ComposeMessageActivity(3881): initActivityState: null, Intent { act=android.intent.action.SEND_MSG typ=audio/amr cmp=com.android.mms/.ui.ComposeMessageActivity (has extras) } 
  2. 06-17 11:29:44.648: VERBOSE/MmsProvider(139): Delete uri=content://mms/9223372036854775807/part, match=11 
  3. 06-17 11:29:44.738: DEBUG/dalvikvm(3881): GC freed 1436 objects / 118040 bytes in 80ms 
  4. 06-17 11:29:44.848: VERBOSE/MessageTextEditor(3881): Nli: -1 
  5. 06-17 11:29:44.858: DEBUG/Jerry(3881): new mMessageBodyEditor 
  6. 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): savedInstanceState = null 
  7. 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): intent = Intent { act=android.intent.action.SEND_MSG typ=audio/amr cmp=com.android.mms/.ui.ComposeMessageActivity (has extras) } 
  8. 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): mThreadId = 0 
  9. 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): mMessageUri = null 
  10. 06-17 11:29:44.978: DEBUG/ComposeMessageActivity(3881): initFocus: true 
  11. 06-17 11:29:45.008: DEBUG/ComposeMessageActivity(3881): -----------------mMessageUri:null 
  12.  
  13. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity}: java.lang.NullPointerException 
  14. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464) 
  15. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2486) 
  16. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.ActivityThread.access$2100(ActivityThread.java:123) 
  17. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1843) 
  18. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.os.Handler.dispatchMessage(Handler.java:99) 
  19. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.os.Looper.loop(Looper.java:123) 
  20. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.ActivityThread.main(ActivityThread.java:4321) 
  21. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at java.lang.reflect.Method.invokeNative(Native Method) 
  22. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at java.lang.reflect.Method.invoke(Method.java:521) 
  23. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 
  24. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 
  25. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at dalvik.system.NativeStart.main(Native Method) 
  26. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): Caused by: java.lang.NullPointerException 
  27. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.content.ContentResolver.acquireProvider(ContentResolver.java:574) 
  28. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.content.ContentResolver.query(ContentResolver.java:147) 
  29. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.google.android.mms.util.SqliteWrapper.query(SqliteWrapper.java:209) 
  30. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.model.MediaModel.initAudioForDRM(MediaModel.java:361) 
  31. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.model.MediaModel.<init>(MediaModel.java:86) 
  32. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.model.AudioModel.<init>(AudioModel.java:58) 
  33. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.model.AudioModel.<init>(AudioModel.java:52) 
  34. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.ui.MediaPicker.makeNewAudio(MediaPicker.java:257) 
  35. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.ui.MediaPicker.onMediaPicked(MediaPicker.java:346) 
  36. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.ui.ComposeMessageActivity.handleSendIntent(ComposeMessageActivity.java:4023) 
  37. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at com.android.mms.ui.ComposeMessageActivity.onCreate(ComposeMessageActivity.java:2807) 
  38. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 
  39. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2418) 
  40. 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): ... 11 more 


Anyone have an idea to fix this problem ? :?
mrtoto1234
Freshman
Freshman
 
Posts: 7
Joined: Tue May 18, 2010 10:34 am

Top

Re: send MMS with audio

Postby leeza » Sun Aug 22, 2010 9:36 pm

I am learning android myself and i stuck with one problem. I am trying to send MMS from one emulator to another emulator.(I got success in sending SMS between emulator)

I tried different code available online but not getting any success in that.Can you please help me to send MMS from one emulator to another. I want to send image between 2 emulator.

Thank You!
leeza
Freshman
Freshman
 
Posts: 2
Joined: Sun Aug 22, 2010 9:32 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 20 guests