Interactive filter for android.intent.action.CALL

I have an intent filter that looks like this:

<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 great, and when you try to call, my text appears as one of the options. What I want to do is process the called number and ask the user a few questions, and then continue the call. I do this by running the following code after doing any processing that I do:

 Uri phoneCall = Uri.parse("tel:" + numToCall); Intent caller = new Intent(Intent.ACTION_DIAL, phoneCall); startActivity(caller); 

The problem is that it displays the same parameters again from the beginning (own caller and my intent filter). This is not what I want, I want to bypass the intent filter and go directly to the caller. Is there any way to do this? How can I make an intention go directly to the subscriber? I am looking at transferring this to the broadcast receiver, but I’m more likely to go along this route.

thanks

+7
source share
1 answer

You can try disabling your component through PackageManager.setComponentEnabledSetting () [use the DONT_KILL_APP! Flags], but you need to enable the component again before the next call.

Or you could accept Huang's comment above, but find out the components that catch the ACTION_CALL intent and create their own choice if there is more than one other than you - use PackageManager.queryIntentActivities () to get a list of Acts.

Using translation is really the right way.

+2
source

All Articles