Android Call System Interface Intent

Source: Internet
Author: User

Intent jump to the system application in the dial-up interface, contact interface, SMS interface and other features in the development now need to jump directly to dial, contact, SMS interface and so on, find a lot of information, self-organized a bit.

First, we look at the dial-up interface, the code is as follows:

Intent Intent =new Intent (); Intent.setaction ("Android.intent.action.CALL_BUTTON"); StartActivity (Intent);
And
Uri uri = uri.parse ("tel:xxxxxx"), Intent Intent = new Intent (intent.action_dial, URI); startactivity (Intent); both are OK, but if it's a jump, Go to the app and use the code: Intent intent= New Intent ("Android.intent.action.DIAL"); Intent.setclassname ("Com.android.contacts", " Com.android.contacts.DialtactsActivity "); To call Log interface: Intent intent=new Intent (); Intent.setaction (Intent.action_call_  BUTTON); startactivity (intent); To the Contact interface: Intent Intent = new Intent (); intent.setaction (Intent.action_view); Intent.setdata (Contacts.People.CONTENT_ URI); startactivity (intent); to application: Intent intent= New Intent ("Com.android.contacts.action.LIST_STREQUENT");  Intent.setclassname ("Com.android.contacts", "com.android.contacts.DialtactsActivity"); Call Contact Interface: Intent Intent = new Intent (); intent.setaction (Intent.action_pick); Intent.setdata (Contacts.People.CONTENT_   URI); startactivity (intent); Insert Contact Intent Intent=new Intent (Intent.action_edit,uri.parse ("content://com.android.contacts/contacts/" + "1")); StartActivity (Intent) to the Contact List interface Intent Intent = new Intent (InteNt.            Action_insert_or_edit);            Intent.settype ("Vnd.android.cursor.item/person");            Intent.settype ("Vnd.android.cursor.item/contact");            Intent.settype ("Vnd.android.cursor.item/raw_contact");            Intent.putextra (Android.provider.ContactsContract.Intents.Insert.NAME, NAME);            Intent.putextra (Android.provider.contactscontract.intents.insert.company,company);            Intent.putextra (Android.provider.ContactsContract.Intents.Insert.PHONE, tel);  Intent.putextra (Android.provider.ContactsContract.Intents.Insert.PHONE_TYPE, 3);                To SMS interface: Intent Intent = new Intent (Intent.action_view); Intent.settype ("vnd.android-dir/mms-sms");//Intent.setdata (Uri.parse ("content://mms-sms/conversations/"));// This is the number startactivity (intent), to the application: Intent intent = new Intent ("Android.intent.action.CONVERSATION"); Startactivi  Ty (Intent); Here are the other ways to find it online: 1. Search content from Google Intent Intent = new Intent (); Intent.setaction (intent.action_web_search); Intent.putextra (Searchmanager.query, "SearchString") startactivity (intent);   2. Browse the Web URI uri = uri.parse ("http://www.google.com"); Intent it = new Intent (Intent.action_view,uri); startactivity (it); 3. Show Map uri uri = uri.parse ("geo:38.899533,-77.036476"); Intent it = new Intent (Intent.action_view,uri); StartActivity (it   ); 4. Path planning URI uri = Uri.parse ("Http://maps.google.com/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng  &hl=en "); Intent it = new Intent (Intent.action_view,uri); startactivity (it); 5. Dial the phone URI uri = uri.parse ("tel:xxxxxx"); Intent it = new Intent (intent.action_dial, URI); startactivity (it); URI = Uri.par                SE ("tel:" +number);                Intent = new Intent (Intent.action_call,uri);   StartActivity (Intent); One of the different tests you know. 6. Call the SMS program Intent it = new Intent (intent.action_view) It.putextra ("Sms_body", "The SMS Text"); It.settype ("  Vnd.android-dir/mms-sms "); startactivity (it);                and URI = Uri.parse ("Smsto:" + the number of the other person to send the text message to); Intent = new INtent (Intent.action_sendto,uri);        StartActivity (Intent), and mintent = new Intent (Intent.action_view);        Mintent.putextra ("Address", C.getstring (C.getcolumnindex (column)));        Mintent.settype ("vnd.android-dir/mms-sms");    StartActivity (mintent); 7. Send sms URI uri = uri.parse ("smsto:0800000123"); Intent it = new Intent (intent.action_sendto, Uri); It.putextra ("Sms_body" , "the SMS text"); startactivity (it); String body= "This is SMS Demo"; Intent mmsintent = new Intent (intent.action_sendto, Uri.fromparts ("Smsto", number, null)); Mmsintent.putextra (Messaging.key_action_sendto_message_body, BODY); Mmsintent.putextra (Messaging.KEY_ACTION_ Sendto_compose_mode, True); Mmsintent.putextra (messaging.key_action_sendto_exit_on_sent, True); StartActivity ( mmsintent); 8. Send the MMS uri uri = uri.parse ("Content://media/external/images/media/23"); Intent it = new Intent (intent.action _send); It.putextra ("Sms_body", "some text"); It.putextra (Intent.extra_stream, URI); It.settype ("image/png"); StartactivitY (it); StringBuilder sb = new StringBuilder () sb.append ("file://"); Sb.append (Fd.getabsolutefile ()); Intent Intent = new Intent (Intent.action_sendto, Uri.fromparts ("Mmsto", number, NULL));//Below extra datas is all Optional.intent.putExtra ( Messaging.key_action_sendto_message_subject, SUBJECT); Intent.putextra (Messaging.key_action_sendto_message_body, body); Intent.putextra (Messaging.key_action_sendto_content_uri, sb.tostring ()); Intent.putextra (Messaging.KEY_ Action_sendto_compose_mode, Composemode); Intent.putextra (Messaging.key_action_sendto_exit_on_sent, exitOnSent);   StartActivity (Intent); 9. Send email URI uri = uri.parse ("mailto:[email protected]"); Intent it = new Intent (intent.action_sendto, URI); StartActivity (it); Intent it = new Intent (intent.action_send); It.putextra (Intent.extra_email, "[email protected ], It.putextra (Intent.extra_text, "The email Body TEXT"), It.settype ("Text/plain"); StartActivity ( Intent.createchooser (IT, "Choose Email Client"); Intent it=new Intent (intent.actIon_send); String[] tos={"[email protected]"}; String[] ccs={"[email protected]"};it.putextra (Intent.extra_email, TOS); It.putextra (INTENT.EXTRA_CC, CCS); It.putextra (Intent.extra_text, "The email body text"), It.putextra (Intent.extra_subject, "The email SUBJECT text");     It.settype ("message/rfc822"); StartActivity (Intent.createchooser (it, "Choose Email Client")); Intent it = new Intent (intent.action_send) It.putextra (Intent.extra_subject, "The email SUBJECT text"); It.putextra ( Intent.extra_stream, "File:///sdcard/mysong.mp3"); Sendintent.settype ("Audio/mp3"); StartActivity (   Intent.createchooser (IT, "Choose Email Client")); 10. Play Multimedia Intent it = new Intent (Intent.action_view); Uri uri = uri.parse ("File:///sdcard/song.mp3"); It.setdataandtype (URI, "Audio/mp3"); startactivity (it); Uri uri = Uri.withappendedpath (MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); Intent it = new Intent (intent.action_   VIEW, URI); startactivity (it); 11.uninstall apk uri uri = uri.fromparts ("package", StrpackaGename, null); Intent it = new Intent (Intent.action_delete, URI); startactivity (it); 12.install apk Uri Installuri = uri.fromparts ("package", "XXX", null); returnit = new Intent (intent.action_package_added,   Installuri);          13. Open camera <1>intent i = new Intent (Intent.action_camera_button, NULL);    This.sendbroadcast (i);         <2>long Datetaken = System.currenttimemillis ();         String name = Createname (Datetaken) + ". jpg";         FileName = folder + name;         Contentvalues values = new Contentvalues ();         Values.put (Images.Media.TITLE, fileName);         Values.put ("_data", fileName);         Values.put (Images.Media.PICASA_ID, fileName);         Values.put (Images.Media.DISPLAY_NAME, fileName);         Values.put (Images.Media.DESCRIPTION, fileName);         Values.put (Images.ImageColumns.BUCKET_DISPLAY_NAME, fileName);            Uri Photouri = Getcontentresolver (). Insert (MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent intTphoto = new Intent (mediastore.action_image_capture);         Inttphoto.putextra (Mediastore.extra_output, Photouri);   Startactivityforresult (Inttphoto, 10);        14. Select Picture from gallery Intent i = new Intent ();        I.settype ("image/*");        I.setaction (intent.action_get_content);   Startactivityforresult (i, 11);         15. Turn on the recorder Intent mi = new Intent (media.record_sound_action); StartActivity (MI); 16. Show app Detail list uri uri = Uri.parse ("market://details?id=app_id"); Intent it = new Intent (intent.action_ VIEW, URI); startactivity (it);//where app_id is the application ID, find the id//by clicking on your application on market Home//page, and notice the ID from the address bar just looked for the app ID was not found, the result finds with package name can also URI uri = Uri.parse ("Market://details?i D=<packagename> "); This is a lot simpler. 17 Find application 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 to an application18 open contact list &LT;1&GT         Intent i = new Intent ();         I.setaction (intent.action_get_content);         I.settype ("Vnd.android.cursor.item/phone");   Startactivityforresult (i, request_text);         <2> uri uri = uri.parse ("Content://contacts/people");         Intent it = new Intent (Intent.action_pick, URI);   Startactivityforresult (it, request_text);         19 Open another program Intent i = new Intent (); ComponentName cn = New ComponentName ("Com.yellowbook.android2", "Com.yellowbook.android2.AndroidSearch")         ;         I.setcomponent (CN);         I.setaction ("Android.intent.action.MAIN");                Startactivityforresult (i, RESULT_OK); 20 Add to SMS Inbox contentvalues CV = new Contentvalues (); Cv.put ("type", "1"), Cv.put ("Address", "SMS"), Cv.put ("Body", "SMS Content"), Getcontentresolver (). Insert (Uri.parse ("   Content://sms/inbox "), CV);        21 Query the cursor cursor from a SIM card or contact;        URI Uri;            if (type = = 1) {Intent Intent = new Intent (); Intent.setdata (Uri.Parse ("Content://icc/adn"));        URI = Intent.getdata ();          } else URI = People.content_uri; cursor = Activity.getcontentresolver (). Query (URI, NULL, NULL, NULL, NULL), while (Cursor.movetonext ()) {int Peopleid = cur Sor.getcolumnindex (people._id); int nameId = Cursor.getcolumnindex (people.name); int Phoneid = Cursor.getcolumnindex (People.number);} View a contact, of course this is Action_view, if you change to Action_pick for selection and return action, of course intent is required to return startactivityforresult Uri Personuri = Contenturis.withappendedid (People.content_uri, id);//The last ID parameter is the database BaseID in the contact provider, that is, which row Intent Intent = new Intent ( ); Intent.setaction (Intent.action_view); Intent.setdata (Personuri); StartActivity (Intent);        22 Delete URI = Contenturis.withappendedid (People.content_uri, contact ID);  int count = Activity.getcontentresolver (). Delete (URI, NULL, NULL); 23 Add to Contact: contentvalues CV = new Contentvalues (); arraylist<contentprovideroperation> operationlist = new arraylist<contentprovideroperation> (); ContentProvideroperation.builder Builder = 
 Contentprovideroperation.newinsert (Rawcontacts.content_uri);                    Builder.withvalues (CV);                    Operationlist.add (Builder.build ());                    Builder = Contentprovideroperation.newinsert (Data.content_uri);                    Builder.withvaluebackreference (structuredname.raw_contact_id, 0);                    Builder.withvalue (Data.mimetype, Structuredname.content_item_type);                    Builder.withvalue (structuredname.display_name, "Custom contact name");                    Operationlist.add (Builder.build ());                    Builder = Contentprovideroperation.newinsert (Data.content_uri);                    Builder.withvaluebackreference (phone.raw_contact_id, 0);                    Builder.withvalue (Data.mimetype, Phone.content_item_type);                    Builder.withvalue (Phone.number, "PhoneNumber of the Contact");                    Builder.withvalue (data.is_primary, 1);                    Operationlist.add (Builder.build ());       try {                 Getcontentresolver (). Applybatch (contactscontract.authority, operationlist);                    } catch (RemoteException e) {e.printstacktrace ();                    } catch (Operationapplicationexception e) {e.printstacktrace (); } 23 Select a picture Intent Intent = new Intent (intent.action_get_content); intent.addcategory (intent.category_openable); Intent.settype ("image/*");   Startactivityforresult (Intent, 0); 24 Call the Android device's camera and set the post-capture location Intent Intent = new Intent (mediastore.action_image_capture); Intent.putextra ( Mediastore.extra_output, Uri.fromfile (new File (Environment. getExternalStorageDirectory (). GetAbsolutePath () + "/CWJ  ", android123 +". jpg "));//storage location is SDcard card cwj folder, file name is android123.jpg format startactivityforresult (intent, 0); 25 Search the market for the specified package name, such as Search COM.ANDROID123.CWJ, as follows URI uri = Uri.parse ("Market://search?q=pname: COM.ANDROID123.CWJ "); Intent Intent = new Intent (Intent.action_view, URI); StartActivity (Intent);   26 Get the file information and use the relative software to open view plainprivate void OpenFile (file f) {Intent Intent = new Intent ();   Intent.addflags (Intent.flag_activity_new_task);   Intent.setaction (Android.content.Intent.ACTION_VIEW);   String type = GetMimeType (f);   Intent.setdataandtype (Uri.fromfile (f), type); StartActivity (Intent);  Private String GetMimeType (File f) {string end = F. GetName (). substring (F.getname (). LastIndexOf (".")   + 1, F.getname (). Length ()). toLowerCase ();   String type = "";  if (End.equals ("MP3") | | | end.equals ("AAC") | | end.equals ("AAC") | | end.equals ("AMR") | | end.equals ("MPEG") | |   End.equals ("mp4")) {type = "audio"; } else if (end.equals ("jpg") | | | end.equals ("GIF") | | end.equals ("PNG") | | end.equals ("JPEG")) {type = "image"   ;   } else {type = "*";   } type + = "/*"; return type;

Android calls the system interface intent

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.