The call button starts an activity, it doesn't send a broadcast, as
described in the doc. (Yes this is inconsistent with the camera button and
the camera button should probably be changed.)
On Wed, Dec 3, 2008 at 11:32 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:
>
> Hi,
>
> I cant get this to work. I am trying this for the CALL_BUTTON and on
> the emulator.
>
> Added the lines below to my manifest.
> Created the MyReceiver class just like you do here.
>
> Then trying to register the receiver in OnCreate:
>
> IntentFilter filter = new IntentFilter
> ("android.intent.action.CAMERA_BUTTON");
> Intent intnt = registerReceiver(mCallButtonIntentReceiver,
> filter);
>
> intnt always return null.
>
> What am I doing wrong here ?
>
> TIA
>
> Shimon
>
> On Nov 14, 10:09 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
> > Thanks Guys. I added a receiver with CAMERA_BUTTON intent-filter and
> > it then triggers my Main application. But I am not getting the choose
> > application dialog. Instead, both my Main application and camera
> > application opens.
> >
> > <activity android:name="MainApp"
> > android:label="@string/app_name"
> > android:theme="@android:style/Theme">
> > <intent-filter>
> > <action android:name="android.intent.action.MAIN" />
> > <category
> > android:name="android.intent.category.LAUNCHER" />
> > </intent-filter>
> > <intent-filter>
> > <action
> > android:name="android.intent.action.MY_INTENT"></action>
> > <category
> > android:name="android.intent.category.DEFAULT" />
> > </intent-filter>
> > </activity>
> > <receiver android:name="MyReceiver">
> > <intent-filter>
> > <action android:name="android.intent.action.CAMERA_BUTTON"/>
> > </intent-filter>
> > </receiver>
> >
> > public class MyReceiver extends BroadcastReceiver {
> >
> > @Override
> > public void onReceive(Context context, Intent intent) {
> > Intent newIntent = new
> Intent(".android.intent.action.MY_INTENT");
> > context.startActivity(newIntent);
> > }
> >
> > }
> >
> > -abhi
> >
> > On Nov 14, 2:53 am, Ludwig <[EMAIL PROTECTED]> wrote:
> >
> > > If you have more than one best matching activity for an intent is to
> offer
> > > you a list to pick the desired activity, with the option of using one
> as the
> > > default (ie do not ask again). It is easy to trigger, just by defining
> two
> > > activities with the same intent...Ludwig
> >
> > > 2008/11/14 blindfold <[EMAIL PROTECTED]>
> >
> > > > What happens when more than one application has this in the manifest?
> >
> > > > Thanks
> >
> > > > On Nov 14, 8:53 am, "[EMAIL PROTECTED]"
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Register to receive the intent
> "android.intent.action.CAMERA_BUTTON".
> > > > > Here's how you might add it to your app's manifest:
> >
> > > > > <receiver android:name="CameraButtonIntentReceiver">
> > > > > <intent-filter>
> > > > > <action
> android:name="android.intent.action.CAMERA_BUTTON"/>
> > > > > </intent-filter>
> > > > > </receiver>
> >
>
--
Dianne Hackborn
Android framework engineer
[EMAIL PROTECTED]
Note: please don't send private questions to me, as I don't have time to
provide private support. All such questions should be posted on public
forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---