Android - Know if app already running - android

My application has 2 different possible launch scenarios : standalone or launched by another app (with specific intent).
If launched in standalone mode after it is launched by another app, my app is completely broken (I deal with bluetooth, etc).
Is there any way to know when my app is launched from another app whether or not my standalone app is already running on the device?

Related

I want my flutter app to launch automatically once the android device boots up

I want to know how I can automatically launch a Flutter app once a device boots up. I know It's possible in Native Android apps with java and kotlin but my app is based on flutter.
My use case is that I have an Android Auto like interface app designed for tablets that opens up once the device boots
What you can consider doing here is by pushing a local notification that when clicked, opens the app. App processes can be run in the background automatically by using auto_start_flutter and by requesting for the required permissions using getAutoStartPermission();. Note that this is currently only available for Android.
Launching an app automatically without user consent isn't something that's allowed for security reasons. You may also want to check how apps are developed for Android Auto.

Is there a way to retrieve the current foreground application in Flutter (while app is running in background)?

I am looking to have my Android (Flutter) application running in the background, checking what app is currently running in the foreground.
When a certain app is opened (eg: Snapchat), I would like to redirect the user BACK to my application.
I've seen native android code that can accomplish this, but I was wondering if there were any Flutter-specific plugins that can accomplish this goal?
I'm aware that you can grab a list of currently installed applications using Flutter, but is there a way to see which app is running in the foreground and then redirect back to my own application, or is this something that would have to be done natively?

Make android app that is run as the only app on the android device.

I want to make an android app that runs as the only app on the android device. If the unit is reset I want this app to start up and run.
The reason for this is we are going to be buying these special 7 inch wall mounted tablets which have android OS on them (here is a link to the device: http://www.geekland.co/7-Android-42-Panel-PC-Wall-or-Desk-Mounted-Tablet-with-RJ45-GK-Q896.htm). And we are going to be programming an app that does various things.
However, it is imperative that the app cannot be exited and that if the system restarts, that app is what runs. We don't want random people messing with the device. We want to restrict everything just to that app.
Of course, maybe with an admin password you would be able to exit the app.
Can this be done somehow within an android app? Or does this call for, I don't know, making some new android OS clone or something? (something I'm not sure of how to do).
As I know there are few ways to do this.
Override buttons as in here
Write a home screen application as in here
Lock apps using apps similar to AppLock some can even lock system apps and settings
If the devices are running Lollipop or newer, you can do this with the Task Locking API. First you need to make your app (or some other app) the device owner and grant your app the lock task permission so that locking can be done without user confirmation. Then just add a receiver in your manifest for the BOOT_COMPLETED intent and lock the task when the app starts.
I wrote an open source app that acts as the device owner and simplifies granting lock task permission to your own apps.

How to stop an application from being launched in Android

I am running a background service that restricts users from launching applications, even when my application is not in the foreground. Is there any way to stop them from being able to launch certain applications?
Launching of app is handled by the Launcher. This cannot be controlled from a third party app. Neither Android provides you the app lauch details like a broadcast.

How to prevent launching other application from my application

I want to write an application that can prevent some application from launching. My requirement is to block some application for some period. So what is the way to block or prevent others application from starting or launching through my application.
My question is -- Is it possible to prevent launching other application from my application? If yes then what is the way.
I tried killing the running application. But it only kills when the application is in the background. When the application is in opened state(displayed on the screen) the killing of the application is not working.
So what is the way to block or prevent others application from starting or launching through my application.
Write your own home screen, so you are the one doing the launching, and implement your launching rules there.
This will cover basic scenarios. It will not help with:
Stopping apps that are launched via notifications (e.g., in response to an incoming SMS)
Stopping apps that are launched via other things in the system bar on tablets (e.g., some tablets let you get to the Settings app from there)
Stopping the user from rebooting their device in safe mode and getting rid of your home screen
The only way to handle those scenarios is to create your own ROM mod with adjustments to the operating system, then distribute that ROM mod (e.g., on your own devices).

Categories

Resources