Android call system comes with app

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 you jump to the app, 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 application: intent intent = new Intent ("Android.intent.action.CONVERSATION"); StartActivity (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.parse ("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 Emailuri 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&NBSp;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 Apkuri uri = uri.fromparts ("package", strpackagename, null); Intent it = new Intent (Intent.action_delete, URI   ); startactivity (it); 12.install Apkuri 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 <1 >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); Open another program Intent i = new Intent (); ComponentName cn = New ComponentName ("Com.yellowbook.android2", "Com.yellowbook.android2.AndroidSearch"); I.setcompo Nent (CN); I.setaction ("Android.intent.action.MAIN"); Startactivityforresult (i, RESULT_OK); Add to SMS Inbox contentvalues CV = new Contentvalues (); Cv.put ("type", "1"); Cv.put ("Address", "SMS Address"), Cv.put ("Body", "SMS Content"); Getcontentresolver ().   Insert (Uri.parse ("Content://sms/inbox"), CV); 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 =    Cursor.getcolumnindex (people._id);    int nameId = Cursor.getcolumnindex (people.name);    int Phoneid = Cursor.getcolumnindex (People.number); See a contact, of course, this is Action_view, if you change the selection and return action to Action_pick, of course intent is required to return to use Startactivityforresulturi 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); Delete URI = Contenturis.withappendedid (People.content_uri, contact ID);  int count = Activity.getcontentresolver (). Delete (URI, NULL, NULL); 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 Contacts"); 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 ();} Select a picture Intent intent = new Intent (intent.action_get_content); intent.addcategory (intent.category_openable); Intent.settype ("image/*");   Startactivityforresult (Intent, 0); 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); Search for the specified package name on the market, 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 call system comes with app

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.