Search code examples
androidandroid-intentandroid-activityintentfilter

want to implement option at the time of call


<action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.CALL_BUTTON" />
<action android:name="android.intent.action.DIAL" />

How can i use these actions and where?

I want to give options to the user at the time of call in the android. Just like if i make a call it should first ask from where you want to make a call.

Basically i want to give option to launch my application when phone icon is pressed in the android device in home screen. So is it possible?


Solution

  • add those filters to the activity you want to launch in manifest ( i hope you know how to call using code and the permissions required)

       <activity
        android:name=".activities.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    
    
        <intent-filter>
            <action android:name="android.intent.action.CALL_BUTTON" />
          <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.CALL_PRIVILEGED" />
            <category android:name="android.intent.category.DEFAULT" />
             <action android:name="android.intent.action.VIEW" />
         <action android:name="android.intent.action.DIAL" />
    
       <category android:name="android.intent.category.BROWSABLE" />
          <data android:scheme="tel" />
        </intent-filter>
    
    </activity>