Android system application call. The usage of intent is summarized in the android zone)

Source: Internet
Author: User

Display webpage:

1. Uri uri = URI. parse ("http://www.google.com ");
2. Intent it = new intent (intent. action_view, Uri );
3. startactivity (it );

Display map:

1. Uri uri = URI. parse ("Geo: 38.899533,-77.036476 ");
2. Intent it = new intent (intent. action_view, Uri );
3. startactivity (it );

Path Planning:

1. Uri uri = URI. parse ("http://maps.google.com/maps? F = D & saddr = startlat % 20 startlng & daddr = endlat % 20 endlng & HL = EN ");
2. Intent it = new intent (intent. action_view, Uri );
3. startactivity (it );

Call number:
Call dialingProgram

1. Uri uri = URI. parse ("Tel: xxxxxx ");
2. Intent it = new intent (intent. action_dial, Uri );
3. startactivity (it );

1. Uri uri = URI. parse ("Tel. xxxxxx ");
2. Intent it = new intent (intent. action_call, Uri );
3. To use this function, you must add <uses-Permission id = "android. Permission. call_phone"/> to the configuration file.

Send SMS/MMS
Call the program for sending text messages

1. Intent it = new intent (intent. action_view );
2. it. putextra ("sms_body", "the SMS text ");
3. It. settype ("Vnd. Android-DIR/MMS-SMS ");
4. startactivity (it );

Send SMS

1. Uri uri = URI. parse ("smsto: 0800000123 ");
2. Intent it = new intent (intent. action_sendto, Uri );
3. It. putextra ("sms_body", "the SMS text ");
4. startactivity (it );

Send MMS

1. Uri uri = URI. parse ("content: // media/external/images/Media/23 ");
2. Intent it = new intent (intent. action_send );
3. It. putextra ("sms_body", "some text ");
4. It. putextra (intent. extra_stream, Uri );
5. It. settype ("image/PNG ");
6. startactivity (it );

Send email

1.
2. Uri uri = URI. parse ("mailto: xxx@abc.com ");
3. Intent it = new intent (intent. action_sendto, Uri );
4. startactivity (it );

1. Intent it = new intent (intent. action_send );
2. it. putextra (intent. extra_email, "me@abc.com ");
3. It. putextra (intent. extra_text, "the email body text ");
4. It. settype ("text/plain ");
5. startactivity (intent. createchooser (IT, "Choose email client "));

1. Intent it = new intent (intent. action_send );
2. String [] TOS = {"me@abc.com "};
3. String [] CCS = {"you@abc.com "};
4. It. putextra (intent. extra_email, TOS );
5. It. putextra (intent. extra_cc, CCS );
6. It. putextra (intent. extra_text, "the email body text ");
7. It. putextra (intent. extra_subject, "the email subject text ");
8. It. settype ("message/rfc822 ");
9. startactivity (intent. createchooser (IT, "Choose email client "));

Add attachment

1. Intent it = new intent (intent. action_send );
2. it. putextra (intent. extra_subject, "the email subject text ");
3. It. putextra (intent. extra_stream, "file: // sdcard/mysong.mp3 ");
4. sendintent. settype ("audio/MP3 ");
5. startactivity (intent. createchooser (IT, "Choose email client "));

Play multimedia

1.
2. Intent it = new intent (intent. action_view );
3. Uri uri = URI. parse ("file: // sdcard/song.mp3 ");
4. It. setdataandtype (Uri, "audio/MP3 ");
5. startactivity (it );

1. Uri uri = URI. withappendedpath (mediastore. Audio. Media. internal_content_uri, "1 ");
2. Intent it = new intent (intent. action_view, Uri );
3. startactivity (it );

Uninstall program

1. Uri uri = URI. fromparts ("package", strpackagename, null );
2. Intent it = new intent (intent. action_delete, Uri );
3. startactivity (it );

 

// Call the album
Public static final string mime_type_image_jpeg = "image /*";
Public static final int activity_get_image = 0;

Intent getimage = new intent (intent. action_get_content );
Getimage. addcategory (intent. category_openable );
Getimage. settype (mime_type_image_jpeg );
Startactivityforresult (getimage, activity_get_image );

// Call the System camera application and store the photos taken
Intent intent = new intent (mediastore. action_image_capture );
Time = calendar. getinstance (). gettimeinmillis ();
Intent. putextra (mediastore. extra_output, Uri. fromfile (new file (Environment
. Getexternalstoragedirectory (). getabsolutepath () + "/tucue", time + ". jpg ")));
Startactivityforresult (intent, activity_get_camera_image );

 

 

Uninstall APK

Uri uninstalluri = URI. fromparts ("package", "XXX", null );

Returnit = new intent (intent. action_delete, uninstalluri );

 

Install APK

Uri installuri = URI. fromparts ("package", "XXX", null );

Returnit = new intent (intent. action_package_added, installuri );

 

Play audio

Uri playuri = URI. parse ("file: // sdcard/download/everything.mp3 ");

Returnit = new intent (intent. action_view, playuri );

 

 

// Send the attachment

Intent it = new intent (intent. action_send );

It. putextra (intent. extra_subject, "the email subject text ");

It. putextra (intent. extra_stream, "file: // sdcard/eoe.mp3 ");

Sendintent. settype ("audio/MP3 ");

Startactivity (intent. createchooser (IT, "Choose email client "));

 

// Search for Applications

Uri uri = URI. parse ("Market: // search? Q = pname: pkg_name ");

Intent it = new intent (intent. action_view, Uri );

Startactivity (it );

// Where pkg_name is the full package path for an application

 

// Enter the contact page

Intent intent = new intent ();

Intent. setaction (intent. action_view );

Intent. setdata (people. content_uri );

Startactivity (intent );

 

// View the specified contact

Uri personuri = contenturis. withappendedid (people. content_uri, info. ID); // info. Id contact ID

Intent intent = new intent ();

Intent. setaction (intent. action_view );

Intent. setdata (personuri );

Startactivity (intent );

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.