Display image on screen while charging on Android - java

I am writing an Android application that should display the specific image (Bitmap) while the user is charging his phone.
The life-cycle:
User installs my application.
User does not have to run my application.
When user connects the charger (usb to PC or just an charger), my application automatically starts and show the image on the screen (during charging).
User stops charging the phone, my application hides the image.
How could I achieve it?

If i remember correctly you can get the "ACTION_POWER_CONNECTED" event with a BroadcastReceiver to do whatever you want. Just Google, there are pretty good tutorials ;)

Related

Auto open my app while receiving an incoming call while app is in foreground, background or even if phone is locked.(In Android Java)

I need to develop an app in which my main activity should open automatically whenever I receive an incoming call(whether my app is on background, foreground, killed or even my phone is locked).
Can anyone help me with source code or guide me to develop this app?

Android app with camera shutter onkeyevent when screen is locked or off

I made an app that uses the onkeyevent functions to capture the bluetooth camera shutter buttons with up and down volumes. I am trying to use it for a camera app to take pictures when the screen is off.
However this no longer works if the screen is locked or off. The minute the screen is back on the function works again. So I know the bluetooth is still connected.
Can anyone with experience in this tell me if it's possible for the phone to capture bluetooth events when the screen is off. What changes should I make.

Detect when a user is in a specific location

If I have a restaurant app for example that just orders some food. Is it possible to detect when one of my app users enters the store and then the app does something? For example when the user comes in the app sends a notification or opens up the menu. Also can this be done while the app is neither running on the background nor visually visible?

Camera intent open the camera app (only the first time)

Here is the context:
In my app, I need to capture images, that's why I use camera intent.
This feature works perfectly, but only if the camera app was already been opened once before
Indeed, this issue appears only on a new device, or a new emulator
Here is the problem:
When I want to capture an image, the native camera app just open, giving to me some hints to how take pictures. That's not the camera app IN my app, but the camera app alone. I need to close this camera app, back to my app, and trying again
When I visit the camera app at least one time in the device's life, there is no issue
Here is what I'm looking for:
I want this camera app open in my app, even if it's the first time
I use the classic and official way to captures images
https://developer.android.com/training/camera/photobasics
EDIT
I think the problem is because at the first time, the camera app asked for the location permission. So we need to open the intent without asking this permission, to keep the focus
When I want to capture an image, the native camera app just open, giving to me some hints to how take pictures.
There are ~26,000 Android device models. These ship with dozens, if not hundreds, of different pre-installed camera apps. The behavior of any of those apps on first run of that app will vary by app. Moreover, the decision of how those apps behave when they are first run is up to the developers of those apps, not you or me.
That's not the camera app IN my app, but the camera app alone
It is never "IN [your] app" if you are using ACTION_IMAGE_CAPTURE, as your question suggests that you are. It is always a third-party app, one of many pre-installed ones, or one of the user ones. And, again, the behavior of those apps are up to their respective developers.
I want this camera app open in my app, even if it's the first time
Sorry, but that is not under your control.

Disable Manage Overlay permission turn off if application is a device owner

I am developing such application, that
is running in full screen KIOSK mode and it is advertising until a user touches the screen
when somebody touches the screen the application finishes the advertising activity and start a service
when the activity is in the background, user can try the device (e.g. open Camera, check Android About page in Settings)
to prevent user to do some harm (e.g. factory reset device) I set the application as a device owner and set some user restrictions
the service watches the touches on the screen and after 30 seconds it restarts the advertising
to capture screen touches in a service I add a 1x1dp transparent view to the WM as an overlay and watch the outside touch of the view
My problem is, that
I can't disable user to turn off Manage Overlay permission in the Android Settings, if the permission is turned off it halts the advertising process
My second approach is that I write an Accessibility Service and handle the TOUCH_INTERACTION_START and TOUCH_INTERACTION_END event types, but in this case user can disable the Accessibility Service so the problem is the same
I would be very grateful if somebody can help me how to pass this problem or could suggest a third kind approach
Thanks,

Categories

Resources