Awesome!  I will try it tonight.  Not very foolproof but it should work in
most cases.  Apparently all I was missing was the priority.

Thanks for the help,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Wed, Sep 16, 2009 at 12:07 AM, Pradeep Kaushik <[email protected]> wrote:

> Hi Tikoze,
>  You can very easily implement this feature.
>
> Just have a simple receiver to receive the same intent as the camera that
> is:
>
> android.intent.action.CAMERA_BUTTON
>
> In that receiver class start your required activity as required.
>
> And, in the corresponding AndroidManifest.xml of your application declare
> the receiver as below:
>
> <
> receiver android:name=*".TestReceiver"*>
>
> <intent-filter android:priority=*"10000"*>
>
> <action android:name=*"android.intent.action.CAMERA_BUTTON" */>
>
> </intent-filter>
> </receiver>
>
> The priority field tells Android to first choose the activity with the
> higher priority. I have used a very large value. Maybe even a smaller value
> will work.
>
> Also, in your receiver in the first line of your onReceive itself add the
> following line:
>
> abortBroadcast();
>
> This will set a flag to abort the broadcast so nobody else will receive it
> after you.
>
> So, by setting the priority you are telling Android to choose your receiver
> first and by abortBroadcast you are cancelling the broadcast for Camera so
> it wont open at all.
>
> Hope this helps.
>
> Thanks and Regards,
>
> Pradeep Kaushik
>
> Thanks and Regards
> Pradeep.N.Kaushik.
> Sent from New Delhi, DL, India
>
> On Wed, Sep 16, 2009 at 9:36 AM, Tikoze <[email protected]> wrote:
>
>>
>> Obviously I understand that the ability to do that could cause some
>> developers to abuse it...  And of course I would not like another
>> application to unregister things that my app listens for (if it
>> occurred without the user's knowledge).
>>
>> As an example, I have used an application called Task Switcher.  I
>> don't know how the developer does it, but he provides a setting that
>> makes his app (and only his app) launch when the camera button is
>> pressed.  He lets the user know what will happen and verifies they
>> want to proceed.  I found this ability very useful and handy.
>>
>> I am developing an application very similar to Task Switcher and want
>> to provide the same option to launch my app from the camera button.  I
>> would just prefer that the default camera didn't launch before my
>> app... It makes it look like my app launched the camera and then
>> itself and is very unprofessional-looking.
>>
>> Again, if any one knows how to do this, I would be very grateful.
>>
>> On Sep 15, 5:11 pm, Jeffrey Blattman <[email protected]>
>> wrote:
>>  > seems unlikely (but i have no idea really). you wouldn't think you
>> would
>> > have control over the intents that other apps can listen for / act upon.
>> > how would you like it if some other app came along and unregistered your
>> > app from that intent?
>> >
>> > On 9/15/09 3:40 PM, Tikoze wrote:
>> >
>> > > Since there is no guarantee as to the order that applications will be
>> > > notified, it is almost like I would have to find some way to
>> > > unregister everything else that is listening for the camera button...
>> > > Given Android's security measures, is that even possible?
>> >>
>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to