Skip to main content

How to launch Android app from Dialer

Android give facility to developer and user to use a flexible and open-source platform. In Android, you can take permission for use of Dialer and also the Broadcast Receiver for listening something happened or not.

So, today I am sharing with you how to open Apps through Dialer. Dailing some predefine code | Number which opens our Application.

How to launch Android app from Dialer
How to launch Android app from Dialer

Here Some Java code which listening...

public class DialReceiver extends BroadcastReceiver
{
    @Override
  public void onReceive(Context context, final Intent intent) {

    if (intent.getAction().equals(android.content.Intent.ACTION_NEW_OUTGOING_CALL)) {
        String phoneNumber = intent.getExtras.getString("Intent.EXTRA_PHONE_NUMBER");

             if(phoneNumber.equals("*#588637#")) { 
             //do your stuff
            }
} } }

And use Manifest File to get your Permision for Access Apps in your Mobile Installed.




Comments

Popular posts from this blog

Android Basic Tutorial : Get the Current Date and Time

Here’s a code snipped to get the current date and/or time. This snipped uses the Calendar object (java.util.Calendar) which is a useful class when working with dates.






//Get a calendar object for the current date and time Calendar CurrentDateTime = Calendar.getInstance();
//Example: Get current day of the month

Switch : Material Design Tips

From google material design documentation.
On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.
The on/off slide toggle with the text “on” and “off” included within the asset is deprecated. Use the switch shown here instead. How to add? I. In your build.gradle add latest appcompat library. dependencies { compile 'com.android.support:appcompat-v7:X.X.X'// where X.X.X version} II. Make your activity extend android.support.v7.app.AppCompatActivity. publicclassMainActivityextendsAppCompatActivity{...} III. Declare your SwitchCompat inside any layout.xml file <android.support.v7.widget.SwitchCompatandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:checked="true"/> SwitchCompat is a backward compatible version of the Switc…