drulabs
drulabs

Reputation: 3121

Intent filter data attribute parameters for dialer integration

I created a dialer for android. I integrated it with default dialer. Whenever I click call I get complete action using dialog. My App is fine till this point.

I want my app as one of the complete action using options only when the number being dialed is 10+ digits

Now what I want is to avoid some numbers like USSD codes, premium number etc, which can be in user's contact book. So Whenever user clicks on call USSD codes or premium numbers from dialer, I don't want my app as one of the options. How to set intent filter for this. I am assuming my filter has to be in the manifest.

My app should show up only when the number being dialed is 10+ digits

I have found examples for mime type, URLs, but could not find any example for dialer.

here is my manifest entry for activity

    <activity android:name=.ActivityCallMore" 
        android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="portrait"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.CALL_PRIVILEGED" />
            <action android:name="android.intent.action.DIAL" />
            <action android:name="android.intent.action.CALL_BUTTON" />
            <!-- <action android:name="android.intent.action.VIEW" /> -->
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="tel" />
        </intent-filter>
    </activity>

Thanks in advance.

Upvotes: 2

Views: 927

Answers (1)

emrys57
emrys57

Reputation: 6806

Sorry, I don't think this can be done.

I imagined that it would be something like

<data android:pathPattern="...........*" />

but http://developer.android.com/guide/topics/manifest/data-element.html points out that pathPattern is

meaningful only if the scheme and host attributes are also specified for the filter.

and there is no host to specify in a tel://0123456789 URI. A similar problem is listed as a "medium priority defect" since 2009 at https://code.google.com/p/android/issues/detail?id=3368.

Let's hope someone else can prove me wrong.

Upvotes: 2

Related Questions