Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Intent Filter?

I am trying to register my Activity so that it can be used by the Activity chooser/picker allowing a user to choose whether or not to select my application/Activity to complete what they are trying to do.

I want to provide the option for the user to be able to select my application when they want to send an SMS message and when they want to place an outgoing call, to try to achieve this I added the following pieces of code within my Activity tags in my manifest:

<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

However the Activity chooser never appears and the native apps are used without providing a choice to the user. Can anyone see where I am going wrong?

EDIT:

I have figured out I need to add

<data android:scheme="sms" />
<data android:scheme="smsto" />

for the SMS message but what do I use for the outgoing call?

EDIT 2:

I have tried the following for the outgoing call:

 <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>

But again with no luck, has this been blocked from 1.6 on?

Edit 3:

This is what happens when I click Text Mobile:

alt text

So i want the same thing when I click Call mobile

like image 987
Donal Rafferty Avatar asked Nov 01 '10 12:11

Donal Rafferty


People also ask

What does the intent filter do in android?

An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component.

What is intent filter example?

The intent filter specifies the types of intents that an activity, service, or broadcast receiver can respond. Intent filters are declared in the Android manifest file.

What is intent filter in android Javatpoint?

In android, Intent Filter is an expression in the app's manifest file (ActivityMainfest. xml) and it is used to specify the type of intents that the component would like to receive.

What is intent filters and broadcast receivers?

BroadcastReceiver : 'Gateway' with which your app tells to Android OS that, your app is interested in receiving information. Intent-Filter : Works with BroadcastReceiver and tells the 'What' information it is interested to receive in. For example, your app wants to receive information on Battery level.


1 Answers

I think it should help you

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

Tested on Android 2.1

like image 165
Konrad Avatar answered Sep 28 '22 04:09

Konrad