Install the specified APK
Public void setupapk (string
Apkname ){
String filename =
Environment. getexternalstoragedirectory ()
+ "/" + Apkname;
Intent intent = new intent (intent. action_view );
Intent. setdataandtype (URI. fromfile (New
File (filename )),
"Application/vnd. Android. Package-Archive ");
Mservice. startactivity (intent );
}
Enter the contact page
1. Intent intent = new intent ();
2. Intent. setaction (intent. action_view );
3. Intent. setdata (people. content_uri );
4. startactivity (intent );
View specified contacts
1. Uri personuri = contenturis. withappendedid (people. content_uri, info. ID); // info. Id contact ID
2. Intent intent = new intent ();
3. Intent. setaction (intent. action_view );
4. Intent. setdata (personuri );
5. startactivity (intent );
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 the dialup Program
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. Uri uri = URI. parse ("mailto: xxx@abc.com ");
2. Intent it = new intent (intent. action_sendto, Uri );
3. 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. Intent it = new intent (intent. action_view );
2. Uri uri = URI. parse ("file: // sdcard/song.mp3 ″);
3. It. setdataandtype (Uri, "audio/MP3 ″);
4. 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 );