Android custom dialler on tapping phone number lin

2019-03-03 10:13发布

问题:

I have to implement custom dialler application. Well it will not make regular phone call, instead it will connect to some service to estabilish VoIP connection. That is simple part I think I can handle it. But the other part is a bit tricky for me. I want to "register" my dialler somehow in the system to have it in context menu when you click on a phone number link in an e-mail for example. Now, when you click the number, default dialler appears. I want context menu to be shown where you can select if you want to use phone or my dialler. Is it possible? Can someone provide me some more tips?

OK. I know I have to create some intent-filter for that. Here is what I did but it does not work. Still no "My App" in the context menu when clicking phone number in some e-mail message.

<intent-filter android:priority="100">
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <action android:name="android.intent.action.DIAL" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="tel" />
    <data android:scheme="callto" />
</intent-filter>

回答1:

Tha answer for your question is:

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