Skip to main content

Posts

Showing posts from 2016

Get Phone Number from Contact List - Android Tutorial

When you create an application to send sms or an application to make calls, getting a destination number from the contacts list is a common task. In this Android tip, I am going to show the code to fetch a number from the contacts list. Now let me tell you how to achieve the goal. First, you need to create an Intent object for the PICK_ACTION action. To open the contacts list, the table that contains the contacts information must be specified as a parameter of the constructor of the Intent class. You can refer to the table using ContactsContract.Contacts.CONTENT_URI. Then call the startActivityForResult () method passing the Intent object and request code to open the contacts list. After a contact is selected from the contacts list, to get the result, you need to override the onActivityResult(int reqCode, int resultCode, Intent data) method of the activity. You can call the getData() method of the data parameter to get the table or uri that contains the selected contact. From the t...

SMS Messaging - Android Tutorial

Understanding how to use SMS Messaging in your application can provide you with many ideas to create the next killer application. In this article, we take a look at how you can programmatically send and receive SMS messages in your Android application Sending SMS messages STEP-1 : To get started, first launch Studio/Eclipse and create a new Android project(Basic Activity). Name the project as you like(mine - MrBrown-SMS) STEP-2: Android uses a permission-based policy where all the permissions needed by an application need to be specified in the  AndroidManifest.xml  file. By doing so, when the application is installed it will be clear to the user what specific access permissions are required by the application. For example, as sending SMS messages will potentially incur additional cost on the user’s end, indicating the SMS permissions in the  AndroidManifest.xml  file will let the user decide whether to allow the application to install or not. ...