There are many applications that can be reused by custom built applications because of the power of the android design that is based on implicit intents.
In this blog we are taking about the reuse the existing android application.
1. Create a application an android project.
2. Copy the any one of following code and paste into the onCreate() in mainactivity
3. Place the appropriate permission in the Androidmainfeast.xml file.
Call Function
Permission : android:name="android.permission.CALL_PHONE"
Code : 1. Call a number
Intent callNumber = new Intent();
callNumber.setAction(android.content.Intent.ACTION_CALL);
callNumber.setData(Uri.parse("tel:9789039333"));
startActivity(callNumber);
2. Browse the web for a given url:
Permission : android:name="android.permission.INTERNET"
Code :
Intent searchGivenText = new Intent(Intent.ACTION_WEB_SEARCH);
searchGivenText.putExtra(SearchManager.QUERY, "Android + Ganesan shanmugam");
startActivity(searchGivenText);
3. View google maps for a given location
Permission :android:name="android.permission.INTERNET"
Code :
Intent searchAddress = new Intent(Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=Bangalore"));
startActivity(searchAddress);
4. View Contacts on the phone
Permission : android:name="android.permission.READ_CONTACTS"
Intent contacts = new Intent();
contacts.setAction(android.content.Intent.ACTION_VIEW);
contacts.setData(People.CONTENT_URI);
startActivity(contacts);
In this blog we are taking about the reuse the existing android application.
1. Create a application an android project.
2. Copy the any one of following code and paste into the onCreate() in mainactivity
3. Place the appropriate permission in the Androidmainfeast.xml file.
Call Function
Permission : android:name="android.permission.CALL_PHONE"
Code : 1. Call a number
Intent callNumber = new Intent();
callNumber.setAction(android.content.Intent.ACTION_CALL);
callNumber.setData(Uri.parse("tel:9789039333"));
startActivity(callNumber);
2. Browse the web for a given url:
Permission : android:name="android.permission.INTERNET"
Code :
Intent searchGivenText = new Intent(Intent.ACTION_WEB_SEARCH);
searchGivenText.putExtra(SearchManager.QUERY, "Android + Ganesan shanmugam");
startActivity(searchGivenText);
3. View google maps for a given location
Permission :android:name="android.permission.INTERNET"
Code :
Intent searchAddress = new Intent(Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=Bangalore"));
startActivity(searchAddress);
4. View Contacts on the phone
Permission : android:name="android.permission.READ_CONTACTS"
Intent contacts = new Intent();
contacts.setAction(android.content.Intent.ACTION_VIEW);
contacts.setData(People.CONTENT_URI);
startActivity(contacts);