I'm developing a qr ticket scanner app to check in thousand+ tickets each device and i wonder if it saves battery to just let a camera fragment run in background, with a little check-in overlay fragment OR if i should stop the camera, switch to another activity to check in and start the camera again each time.
the check-in only takes few seconds (scan -> validate -> click check-in -> scan next)
i expect the start/stop of a camera to use more battery life after all
Related
I am currently using the default camera to take photos for my app.
It currently displays Retry and OK buttons at the top of the screen when launched, is there any way of adding cancel to this, which would return the user to the app?
No, it is not possible. Since we launch the default camera app with startActivityForResult(), which means you are kind of moving out of the app and seeking Result on completion of task on the CameraIntent. Customizing Camera intent is in not your hand untill Camera app exposes some API to do so(which is not yet available).
I have developed an android watch app. It has a play button which when you click starts the sensor manager to analyse the sensor data. Using the data, I recognize the gestures performed by the user. So when I press the play button, sensor data analysis starts and the user can see a stop button to stop the sensor whenever he wants. So once the sensor is started, if I swipe and go back to the home screen and the again open the app, I can see the play button instead of stop button. I want to see the stop button when the user returns. Ideally I want to run a foreground service to detect the sensor readings.
So I want to start a foreground service when the user hits the play button and when the user open the notification, he must see the stop button to stop the sensor data as well as the service. How can I do this? Please advise.
UI:
Save your required UI data to the Bundle of the current states (stop button appearing) using onSaveInstanceState for that instance to your onPause() so that it can be retrieved by the onResume() using onRestoreInstanceState and viewed.
Service:
The Service should be bound to the activity so the two communicate directly. The service can be stopped from the activity using
stopService(new Intent(this, MyService.class));
You can also call stopSelf() from within the Service.
I am Developing an android application that should record the change state of the camera device in my phone in which every time I open the camera from any other application in my phone this application should save that application "X" open the camera at time "Y" and so on.
I have reached in my code to record the time that the camera was opened and close but I could not figure out how to discover the program name who has held the camera.
You could check the job queue from your BroadcastReceiver and see what is the current app.
related topic
I have built an app where in you take pictures and GPS data of that picture is captured for GPS I implemented service and implemented location listener for it. Its working fine but it drains battery so I am planning to change a Lil bit I will start the GPS service when user decides to take pic in my app.. And remove the listener on picture taken. This works fine provided the button to capture is taken after the GPS search is finished else GPS data accuracy is not there. So I have thought to show a dialog fragment to user saying GPS is initializing and ask user to wait. And once GPS location is set the dialog fragment should disappear and user must be able to take picture by the button provided. My problem is how do I capture the event That GPS search is completed .. I am using built in GPS satellite.
Can anyone help me to achieve Bulk Scan Mode using Zxing library inside my app. What it does now is that after scanning a barcode the camera screen disappears and the scan result is populated on my Activity. But I need to do is scan multiple barcodes one after the other and then return back to my activity on back button press.
You mean return several values back to the app? No it can't be set to do that. The app can export the scan history, and you can register as an app that can handle a share of text/csv data. Maybe that is roughly close enough to a solution.