When I launch an application for the first time then service should be started - but separately from current application. So when I delete this application , service should still work. Is it possible in Android?
Fortunately, no, for obvious security reasons. If the user uninstalls ("delete") the application, everything is removed.
You are welcome to have two separate applications, though.
Related
I am developing an application for a business entity. That application should run in the background in every employees' mobile phone. Employees are mostly salesman. The application basically detects location changes and suggest the salesman where they might visit. A kind of reminder application. It also lets other salesmen see where are their teammates.
Right now I am using a foreground activity and it works fine till the system forcefully doesn't kill the service or the phone doesn't reboot due to manual activity or battery discharge.
Ones the application is closed, as of now, the managers in the firm needs to call salespeople to turn on the application once, as on application start it automatically turn on its foreground service. But this is really an extra burden on the management team which can be automated.
I am ok to have any settings based or code based solution. One solution is to root the phones of salespeople and install some extra utility app or write the code based on root APIs, but this will be too much for this simple task.
THe permission RECEIVE_BOOT_COMPLETED was not added properly in the manifest. After adding the permission it worked calmly. In on receive method of the broadcast receiver, I am starting the foreground service.
At the moment, the best way is to use WorkManager https://developer.android.com/topic/libraries/architecture/workmanager/ Yes, it still alpha, but works very good.
From other side, you could work on automating the task "managers in the firm needs to call salespeople to turn on the application once". I mean, an app/backend could automatically call the salesman (with some pre-recorded message) or send SMS to them.
I am developing an app where i need to keep background service running even if user uninstalls app. this is more like what uber did with its ios app to track users (https://www.wired.com/2017/04/uber-didnt-track-users-deleted-app-still-broke-rules/).
I tried to make service as system service which actual a bad idea.
ServiceManager.addService("downloader", new MyService());
looking forward for help.
I am developing an app where i need to keep background service running even if user uninstalls app.
That is not possible, fortunately.
Is it possible to start a service without open the app or without launching the app. Explaining the scenario
User Download and install the app.
User do not open the app. Even not a single time after the installation.
Now I want to start a service in above scenario, maybe on reboot of device or any other way.
Is it possible? Many blogs and posts say that it's not possible.
Is it possible
Not since Android 3.1, to help prevent "drive-by" malware installations.
I was wondering if I can kill app from other app. I mean I want to create application which when I start this application I will check status other application and if app, which name is for example "Startex" is running then I kill "Startex" app and run my second application.
No you can not. Only Android can kill application if it needs memory. In order to do this you should know the PID of the application you want to kill and invoke a syscall at kernel level
If both apps are designed by you then you can have shared user id in both the Apps then you can kill another app here is the way.
This can't be, or at least should never be done. Android itself is supposed to control when an app is no longer required, usually based on needing to free up some memory for another app that may be opened. Google frown upon developers killing the app themselves without letting Android handle it, and likely would never receive any promo place on the play store from Google.
When a user tries to launch an application I want to suppress that application and then call another application. Example I want the user to authenticate himself before launching a particular system application (settings application etc). The authentication application should pop up every time the user launches the settings application
I know you will have to use broadcast receivers and intents but have no clue how to do it.
Sounds like you should create a "lib" project that have public interfaces that you can use.
Then share them between the apps instead of trying to execute another app?
But what I know this is not possible to actually execute up another app, since this then gives dependency to something that you don't know if it is installed. It must already been started if the intents should work.
Also like the answer before, it could be used for abuse.
Look at this link for more information:
http://mylifewithandroid.blogspot.com/2007/12/playing-with-intents.html
I sort of hope this isn't possible... Launching a different application from the one the user actually clicked? Leaves the door open for abuse.