开发者

Android: opening a choice popup for a call whenever a user calls

开发者 https://www.devze.com 2023-03-08 12:56 出处:网络
This is a continued question from: Android: How to interact with the default Contacts application Hello 开发者_如何学JAVAall,
  • This is a continued question from: Android: How to interact with the default Contacts application

Hello 开发者_如何学JAVAall,

I'm trying to show a popup to let a user choose if the user wants use the standard dialer or another one like below:

Android: opening a choice popup for a call whenever a user calls

I heard that 'sipdroid' has a similar function and 'CapDroid' gave me a good code(which is below) from my last question, which shows me a choice popup after I call and then HANG UP.


<intent-filter> 
  <action android:name="android.intent.action.VIEW" /
  <category android:name="android.intent.category.DEFAULT" /> 
  <category android:name="android.intent.category.BROWSABLE" /> 
  <data android:mimeType="vnd.android.cursor.dir/calls" /> 
</intent-filter>

I tried to modify this code to pop up the choice dialog whenever a user tries to CALL like using the default CONTACTS or pressing the main call button, but failed and still have no idea what to do.

If anybody has an idea or tutorial for this, would you please give me an advice?


I found a solution from: Android - Intent Filter?

You allow a permission and intent-filter of call_privileged like below


<uses-permission android:name="android.permission.CALL_PHONE">

<intent-filter >
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="tel" />
</intent-filter>


It's should work for you

<activity>
  <intent-filter>
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="vnd.android.cursor.item/phone" />
    <data android:mimeType="vnd.android.cursor.item/phone_v2" />
    <data android:mimeType="vnd.android.cursor.item/person" />
  </intent-filter>
</activity>

Read there for mode detail.

0

精彩评论

暂无评论...
验证码 换一张
取 消