0

Hai , I need a solution for , how to send an image behind the scenes i.e; with out users further input ? Can any one help me to sort out this ?

thanking you . Srinivas

Anthony Graglia
  • 5,355
  • 5
  • 46
  • 75
Srinivas
  • 1,688
  • 8
  • 30
  • 51

2 Answers2

1
  Uri uri = Uri.fromFile(new File(imagePath));
        Intent i = new Intent(Intent.ACTION_SEND);
//      i.setAction(Intent.ACTION_VIEW);
        i.setType("image/jpeg");
        i.putExtra("sms_body", autoMessage);
        i.putExtra("address", phoneNumber);
        i.putExtra(Intent.EXTRA_STREAM, uri);
        startActivity(i);

This is the code am using to send mms , its fire mms application again ?

Srinivas
  • 1,688
  • 8
  • 30
  • 51
0

Whatever "send an image behind the scenes" means, to launch an action delayed in time without users further input you can use the following code:

    // Need handler for callbacks to the UI thread
    final Handler mHandler = new Handler();

    // Create runnable for posting
    final Runnable doSomething = new Runnable() {
        public void run() {
             sendImageBehindScenes();
        }
    };

    // launch doSomething after 2000 milliseconds
    mHandler.postDelayed(doSomething , 2000);

If this doesn't answer your question, please rephrase it.

Maragues
  • 37,861
  • 14
  • 95
  • 96
  • Thank for your reply , Let me explain my scenario , I want send mms programmatically . Uri uri = Uri.fromFile(new File(imagePath)); Intent i = new Intent(Intent.ACTION_SEND); // i.setAction(Intent.ACTION_VIEW); i.setType("image/jpeg"); i.putExtra("sms_body", autoMessage); i.putExtra("address", phoneNumber); i.putExtra(Intent.EXTRA_STREAM, uri); startActivity(i); i did it in this way. But again am getting widget to send mms . so , but i have to send directly . – Srinivas Aug 27 '10 at 09:55
  • Please add this text to the question so that it's easier to read. I still don't get what you want, but if you want to send an MMS check this answer: http://stackoverflow.com/questions/2972845/i-want-send-image-through-using-mms-in-android/2973016#2973016 – Maragues Aug 27 '10 at 10:10
  • I don't want to fire up the messaging application. The MMS should be sent behind the scenes. Here is the full story: In my application , i have to respond to incoming sms , automatically , i.e; my applicatioon will send an image and message . just need to be able to send the MMS with out asking for user input. – Srinivas Aug 27 '10 at 10:24
  • Then you'll need a BroadcastReceiver that sends a MMS when a SMS is received: http://developer.android.com/intl/fr/reference/android/content/BroadcastReceiver.html is the class, search for code examples. You should have said that from the very beginning :) – Maragues Aug 27 '10 at 10:27
  • Thanks for ur reply , sms is working fine , only problem with mms , i mean when i add image . ithen firing an mms application to send mms . – Srinivas Aug 27 '10 at 10:34