[android-developers] Problem launching my own (camera) application on press of Camera-button (part 2)

2010-03-07 Thread Streets Of Boston
I am reviving this thread again...
http://groups.google.com/group/android-developers/browse_frm/thread/6ce3f666d4a64bd5/e22a089fd7fcfb50

I have tried Marco's suggestion, but it doesn't work.
It seems the broadcast is not ordered and canceling/aborting it has no
effect. This causes for both my and the default camera app to be
started up *at the same time*.

Is there a way to register another 3rd party camera activity as the
default or at
least as an option for becoming the system's camera app when the
dedicated
'camera key' is pressed?

Thanks!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Problem launching my own (camera) application on press of Camera-button

2009-03-19 Thread Streets Of Boston

When i press the phone's camera button, both my application and the
system's camera application are launched:
- I press camera button
- After a few seconds, my camera app appears and all looks good.
- However, when i go back (back-button), i'm not brought back to where
i was before.
  Instead, i'm brought (back) to the system's camera application.

It looks like both camera apps are launched: The system's camera app
is launched and on top of that my camera app is launched.

I expected the activity-chooser to appear asking which camera app i'd
like to start (with an option of making one the default).

Here are some code snippets:
Manifest:
receiver android:name=.camera.CameraReceiver
intent-filter
action
android:name=android.intent.action.CAMERA_BUTTON/
/intent-filter
/receiver
activity android:name=.camera.SmugCamera
android:label=@string/app_name
android:screenOrientation=landscape android:icon=@drawable/
camera
android:clearTaskOnLaunch=true
android:taskAffinity=smugdroid.task.camera
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.DEFAULT /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
intent-filter
action android:name=android.media.action.IMAGE_CAPTURE /
category android:name=android.intent.category.DEFAULT /
/intent-filter
/activity

CameraReceiver.java:
public void onReceive(Context context, Intent intent) {
KeyEvent event = (KeyEvent) intent.getParcelableExtra
(Intent.EXTRA_KEY_EVENT);

if (event == null) {
return;
}

Intent i = new Intent(Intent.ACTION_MAIN);
i.setClass(context, SmugCamera.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}

Do i have to change the onReceive method to use Intent.createChooser
(...) instead?
Or is there some other problem i'm not aware of?

Thank you.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---