Services - A fancy use?

DeerBear

Member
Licensed User
Longtime User
Hello!

I am creating an app that uses the camera.

I would like to be able to decide the picture size.
I can do this easily using the Advanced Camera Library.
However, the documentation states that, to do anything
with the camera, you need to preview it.
Which is fine, however it also presents a "crowd"
problem: i.e. I want to avoid having to declare an
object everywhere and use only one as singleton.

Thus, what I was thinking to do is this:

- Create a service, originally named SPeripherals
- Add an "AdvancedCamera" object here(all events will be
handled in the service)
- Connect to the photo taking activity(I already have that)
- Manage requests from other activities in the service

Basically, what I want to do is a sort of "MSMQ" in a service.
Would you advise it's a good idea? If you think it's not, why?
What are the problems I may encounter?

Thank you.

A
 

DeerBear

Member
Licensed User
Longtime User
The problem is that the Camera object is an "activity object". This means that internally it requires the context of an activity.
You will not be able to declare a global camera object anywhere else than Activity Sub Globals.

Now that I read your post again I'm not sure that I fully understand it...

The first part is a real bummer.

My idea is to have services that act as queues:

One service takes care, say, of the camera or other peripherals.
Another takes care of downloading, for instance.
Say that a download has finished and the relevant activity has been
notified, I want to send a "message" to the peripherals service to, for
instance, take and upload a picture.
But the service is already doing something, say it's using the
accelerometer, whatever, then I queue the other request.
When this is finished, I tell my user "Look mate, this activity
needs you to take a picture".

Do you see my point now?

A
 
Upvote 0
Top