In iOS device, we can kill a foreground app with the hard buttons. We can do it by the way written below:
1. Push down the power button and keep pushing
2. Wait for the power-off screen is shown
3. Push the Home button and keep pushing.
If we use this way, the data of the foreground app that is not saved will go away.
Usuually we only use this method when our device freezed, but some game players around me use it for other purpose.
But I dont know the same method in Android.
Do you know the method to kill the foreground app with the hard button, and without running onPause()?
If you know, could you tell me it?
*I am a (private) junior high school student in Japan. I think I am better at using English than public school students, but there may be some grammer mistakes, wrong collocation, or spelling mistakes. So please read carefully.
Any answers or hints will be thanked.
I'm waiting for your good answers or hints!
If you mean killing an application screen progrmatically use -
finish();
once you leave the activity for another screen, if you mean physically (using the device physical buttons) than a long push on the home button will show you all the apps running on the foreground swipe them to the left or to the right in order to terminate them
However some apps uses services in order to fetch data or make logic operations which are unbound to the UI for those you should go to the "Application manager" on your device setting and kill them manually (by pressing stop) you can also use this app.
Related
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.
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
I was just bored of iOS and I recently changed to Android. I have a Nexus 5 device, and I've just finished installing my favourite apps in my device.
One of those apps is Line, the famous communication app from naver. I installed it and I configured it with a passcode in order to secure access to it, so no one despite me could see the "confidential" conversations inside.
The problem is even if I have the passcode enabled on line, if someone presses the "Recent list applications" button, they can see perfectly a screenshot of Line with my last conversation, so anyone could see what I was doing in Line.
I made the same test on iPhone and .. surprise ... iOS is taking the snapshot AFTER the passcode screen is enabled, so anyone could see nothing. It seems that in Android the snapshot is taken BEFORE passcode screen is enabled so anyone could see what last line screen looks like :)
So, having read other threads on this forums, I'm supposed to have several ways to solve this:
Wait for LINE's company NAVER to add an option to prevent this app to show on recent app list (adding android:excludeFromRecents="true" on THEIR manifest) [that won't be soon]
Wait for LINE's company NAVER to force the snapshot after passcode screen is enabled [maybe soon but not in company'sroadmap]
Decompile apk and change manifest on my own - or use FLAG_SECURE - (I tried it but when I launch the new app it suddenly dies on startup with a message "Application stopped". I thing LINE's server verifies on startup that the client app is what is expected to be, comparing sizes or something else)
So I don't know more ways to get around this. Do you have any more idea? I'm stucked on it.
Thank you a lot.
Detect when LINE has left foreground
Create a background service that detects if LINE is on foreground and when it leaves the foreground. (https://stackoverflow.com/a/14044662/1683141)
When line has left foreground, you should take action:
A. Stop the line app completely
OR
B. Open & "close" the line app so it will show a locked state in the multitask thumbnail
A possible way to accomplish situation B:
Optionally: detect which app the user has now opened and remember it
Wait a few seconds and open the LINE app again after the user closed it (by intent for example)
Now the LINE app will show the lock screen
Now let the background service open the home screen (or make an intent to the remembered activity)
Now the LINE app is back to the background and it will have a multitask-thumbnail showing the locked screen.
Ofcourse, this will create a loop, and this isn't a stable solution
-Option A is a relatively reliable, and a (in my opinion) good way to accomplish what you want: no one can see your secure chat. Disadvantage is that the application is now removed from multitasking.
-Option B is only an idea, but maybe, if it's done the right way, It could work.
Edit: Option A will not work. The application will not be removed from multitasking if the task is killed.
I own an android 4.0.3 tablet and I'm programming in Java/SDK, still not tried NDK.
Now, suppose that you want to program this tablet to put it in a service point, with a single use case, like a restaurant, where it would show menus and let the user pass them. I would like not to let the user to shut down this software. Also, it must automatically runs at tablet start up and persisnts on, i.e. if it shuts down by some reason, the tablet should not go back to its standard GUI but to restart this application.
I don't know any start point for this, like some keywords etc. I imagine that here I must code a service (that maintains the persistence and startup of the application) and the application itself.
Could you please give some ideas / keywords / potential start points / comments?
Thank you in advance.
Here some things you need to check:
1.) How to start an application at boot.
2.) How to run a service/thread in background to check if the application is running and if not to start it.
3.) How to deactivate buttons, ie like the "back" button to not exit the app or program a way that the activity never exits with user interference. (That is very bad practice though!) :)
4.) There should be a way to exit the application though for maintenance purposes. Be creative in that one. Maybe exit only with password or something.
I would like to not to let the user to shut down this software so it must persist.
Make it be the home screen.
Also, it must automatically runs at tablet start up and persisnts on, i.e. if it shuts down by some reason, the tablet should not go back to its standard GUI but to restart this application and represent its GUI.
Make it be the home screen.
I am basically looking for the same functionality found in the DevTools (Development.apk) app that comes with the emulator. I am wanting to perform similar testing on an actual device but the DevTools app does not work properly on the device I have so I cannot use it.
I am looking to test in a similar way.
What this does is causes each Activity to be destroyed whenever it leaves the screen, holding onto its instance state just as if the system needed resources and had killed it. (So I can't just call finish)
Is there a way to do this?
Thanks
You can kill your app's process at any time using the DDMS stop button. highlight your application in the list and click the stop sign button. your application will be destroyed like it was killed by the system.
See the stop button in the left pane(Devices) above each device listing: