Android - Intent Filter?

I think it should help you Tested on Android 2.1.

I've added the same intent-filter to my activity, and it works on some phones, but on the HTC Incredible my activity is never presented as a choice to complete the intent. – Eric Sep 20 at 18:15.

This is because activities and services can not pickup outside intents on their own. You need to use a BroadcastReceiver. To implement this, do the following: Extend Android's BroadcastReceiver class like so: public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Context context = getApplicationContext(); Intent sendIntent = new Intent(); if ( intent.getAction().

Equals(Intent. NEW_OUTGOING_CALL) ) { sendIntent. SetClass(context, MyActivity.

Class); context. StartActivity(sendIntent); } else if ( intent.getAction(). Equals(Intent.

SOME_OTHER_INTENT) { sendIntent. SetClass(context, MyService. Class); context.

StartService(sendIntent); } // More else ifs for more intents you want to catch. } } Then you need to declare the receiver in your manifest like this: // more intents you want to catch here Only intents declared in the manifest will be caught by your Receiver, so if you want to catch several intents thrown by the system or other programs and want to do the exact same thing when their intents are caught then specify those intents here in the manifest and skip the if/else blocks in the onReceive method.

1 I don't think that is the correct way for me to achieve what I want, I want to register for the SEND and DIAL intents sent from the system, I have the SEND one working as above when I click on send text the "Complete action using" dialog appears which is exactly what I want, I just need to be able to do the same for when I click on call contact. – Donal Rafferty Nov 1 '10 at 15:22 2 Ah then maybe you need to specify certain permissions for which intents you want your program to be allowed to use. Look at developer.android.Com/reference/android/….

I believe you need to use the CALL_PHONE permission. – AndrewKS Nov 1 '10 at 15:31 Yep, I have that in there too - Cant understand why its not working at all. – Donal Rafferty Nov 1 '10 at 15:53.

You need to add a priority to the intent filter so that Android takes it into account. For example.

Name matters for determining which component should get the intent. A different strategy is needed for implicit intents. To the broadcast announcement.

Components that can potentially receive intents. Capabilities of a component and delimit the intents it can handle. The advertised type.

It can receive only explicit intents. Receive both explicit and implicit intents. Services, and broadcast receivers can have one or more intent filters.

The component is willing to receive. A target class). No matter what it contains; the filter is not consulted.

Present to the user. With a new, blank note that the user can fill in and save. An intent filter is an instance of the IntentFilter class.

Java code, but in the application's manifest file (AndroidManifest. Broadcast receivers that are registered dynamically by calling Context. An implicit intent is tested against the filter in all three areas.

To be delivered to the component that owns the filter, it must pass all three tests. Component — at least not on the basis of that filter. Through one of a component's filters might make it through on another.

The user may be asked which component to activate. No target can be found.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions