How to make an Android app running all the time - android

I am makin an android application on Emergency communication.I want my application should run all the time and whenever it needs it should be able to run.I want that user should not be able to close it by any means.Like Google Maps application which is restarted again on killing its all activities and even we force close it,it will be restarted.

Seems you are learning app development ... but this is not the way you should pose question here... you should post what you have done and code issues and not ask for an entire class...
But i will try to answer your question are you trying to create an app which when started wont be able to be closed and come back to home screen ???!!!!!
See you are creating an app which will run on android operating system which is similar to linux so you must follow the Activity
LifeCycle
I remember i created an app where there were shortcuts on screen so using that i was directing the user to specific links but you can use for calling etc.. i donno if that is what you are searching for...
You might create a notification bar if you want which cannot be cancelled and you can place the code in the intent which will be called from this...
Also services are there which u can utilized what other users have suggested...
thx

You could use an extra service running in the foreground, but there will be always a notification of this service in the notification bar.
See here: http://developer.android.com/guide/components/services.html#Foreground

Related

How does call app works when the call app is removed from task list (aka Overview screen) in Android?

I learned that following is Overview screen.
I clicked the dialer and dialed a number and then swiped the dialer to the right.
But still the call is on like this.
How is this done?
I am a newbie to Android programming. I am thinking if they had used a back ground thread or a separate service or something else, so that it is never killed accidentally. How is this done?
Please help me. Thanks.
I believe it is using the Android foreground service. You can checkout how to run it in the doc:
https://developer.android.com/guide/components/services.html#Foreground
The difference of foreground from background service is when phone is low on memory, system will not automatically close it to release memory, it should be closed manually by user, which is why you need to have a notification as a way for user to close it when you first create it.

Launch android app after start and block other apps

I'm facing the following problem. I want to make an android device to run only my application. All other apps and phone feautes should not be available to a user.
The reason why I want to achieve this is simple: I want to destribute devices with preinstalled application to my client but I don't want to let them use all phone featues.
This could work this way: just after android boots my application is launched automatically and than somehow all other staff is blocked.
Do you have any suggestions how to achieve that? Is it possible? Do I need to root a device?
I hope you get my problem. Any advice you can give will be greatly appreciated.
This is a bit crude way. But see if it is of any help.
If you create your application as a launcher it will start on boot(using system broadcast BOOT_COMPLETED).
Then you need to override all the three android buttons Home, back and recent apps.
To override back button you just have to override the onBackPressed() method.
For home button you will start a service which will run in background. This service will check if your app is in foreground or not. if not then it will bring it in foreground. so when the user presses home the service will sense the foreground app isnt yours and launch it.
But for this switching back of your app android takes approx 3 to 5sec. In that period of time you can display a warning text which will block the user from stopping the service from settings.Also if you remove the activity animations then it will appear seamless.
For recent apps button the above trick will do. If the user tries to close the app using this button your background service will sense it and launch your app.
so its the background service that does all the trick. if you some how stop the service or uninstall the app you are through :p

Forced to stay only mine app and can not open another app

I am developing one android application. In that i need to do below task. Can anyone suggest me how to do below task?
I want to force to user to stay on mine app, he/she can not open
another app. Only mine app is visible to top?
How can i achieve this?
Any help is appreciated .
I had a requirement where I need my App to run in foreground always, so that no other App should be running other than my App. Also, I had created a menu inside my App to Exit the Service that I created that keeps my App running always in foreground (not in this demo).
I had created a demo for the same in my github named as MyBackgroundServiceDemo.
Notes:
My requirement was for Tablet only.
I disabled back button of my App.
When user presses home button it will stay to home for 5 seconds (which is default by Android).
My Service keeps running constantly to keep track of Apps that are running.
I had modified the Service according to my requirement later on to keep track of my requirements. Same way you also modify the Service to meet your requirement.

how to keep application in running mode when create and launched in android?

I want to keep android application run in background not in foreground when it launched. For Example, like Android Settings and Android Keyboard. Only Running Process List in display this application. Actually, this application is running in background and user can't display it in foreground.
No matter what you want to do with your app, if you want it to run in the background and not getting destroyed when it isn't displayed anymore, you have to use Service.
This is the Android Developers site explaining it:
http://developer.android.com/guide/components/services.html
And this is a nice tutorial:
http://www.vogella.com/articles/AndroidServices/article.html
If your code doesn't work with a service, it's probably not the service's fault, but your code's, and you should post another question precisely explaining your problem with it.

How to lock any android application

I am a newbie on android apps development, I want to make a application which can lock any application when started. For eg if someone opens chrome or any other application it simply locks it.
Maybe you will not get any straight forward solution for that.you have to create a service that will run on the background.You can check periodically to find therunning process.Then you can find the package name for the process which you want to kill.Finally use killBackgroundProcess of the ActivityManager to kill the process.This method only kill background process.So if you want to stop browser that starts running simply send that in background(If you bring your activity in foreground it automatically will be back) and run the killBackgroundProcess(pkgName).
Android now allows users to add app widgets to the lock screen form API level 17, i dont know backward comparability supports or not

Categories

Resources