I have an intent filter that looks like so:
<activity
android:name="com.test.Call"
android:label="@string/makeCall" >
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
</intent-filter>
</activity>
This works fine and when you try to make a call my text appears as one of the options. What I want to do is process the number being called and ask the user some questions and then continue on with the call. I do this by running the following code after I do whatever processing I have do do:
Uri phoneCall = Uri.parse("tel:" + numToCall);
Intent caller = new Intent(Intent.ACTION_DIAL, phoneCall);
startActivity(caller);
The issue is, it is displaying the same options from the beginning again (the native caller and my intent filter). This is not what I want, I want to bypass my intent filter and go directly to the native caller. Is there a way to do this? How can I force the intent to go directly to the native caller? I am looking at moving this to a broadcast receiver but would rather go this route.
Thanks
You could try disabling your component via PackageManager.setComponentEnabledSetting() [use the DONT_KILL_APP flags!], but you’ll need to re-enable the component again before the next call.
Or you could take Huang’s comment above but find out components that catch the ACTION_CALL intent and build your own chooser if there’s more than one other than you – use PackageManager.queryIntentActivities() to get a list of Activities.
Using the broadcast is really the right way to go.