After a user opens my application I don't want them to be able to get out. So when they press the home or back button it doesn't let them exit the app. I know there are ways using a service to keep the app always running in the background, but I don't even want them to even exit.
Is this even possible, if so how? Without having to hack the kernel.
I know this sounds odd, but it is not for a commercial app, but for my lab, it will never be on GooglePlay. The tablets will be given to little kids and they will take a test on it, so I can't have them using youtube or anything else.
Related post: Android, How to make the task of the app unclosable? Only closable by task killing
The answer by CommonWare seems to indicate that kernel hacking is the only way, but is it?
Also I am using Android L.
there is no official support yet - there will be support with android L via the Task locking API
The L Developer Preview introduces a new task locking API that lets
you temporarily restrict users from leaving your app or being
interrupted by notifications. This could be used, for example, if you
are developing an education app to support high stakes assessment
requirements on Android. Once your app activates this mode, users will
not be able to see notifications, access other apps, or return to the
Home screen, until your app exits the mode.
https://developer.android.com/preview/api-overview.html
EDIT: as you said you use L this got obsolete - but I leave it here as a hint for others
said that - you are also able to get this kind of work without root today if you have to ( e.g. kiosk mode app on a certain hardware ). It is not simple - and no solution that works for all devices - but if you need it you can get it work with tricks like:
- reacting on home-screen intent ( and setting it as default )
- when you go to background - bring your self foreground again
- ..
It seems google has some thing called COSU for setting up single-purpose devices
Android 5.0 Lollipop introduced two new ways to configure Android
devices for a single purpose:
With app pinning, the device user can temporarily pin specific apps to the screen.
With lock task mode, a user can’t escape the app and the Home and Recents buttons are hidden. Additionally, lock task mode gives the IT
administrator a more robust way to manage COSU devices, as discussed
below.
and
As an IT administrator, you can configure Android 6.0 Marshmallow and
later devices as corporate-owned, single-use (COSU) devices. These are
Android devices used for a single purpose, such as digital signage,
ticket printing, point of sale, or inventory management. To use
Android devices as COSU devices, you need to develop Android apps that
your customers can manage.
from here
and there is a code lab for it here
for earlier versions of android here i founded How-To Create a Working Kiosk Mode in Android which shows some hacks for disabling buttons and restarting the application after boot and lock. note that most of these hacks, don't work on android 6 and later
Related
I was wondering if anyone had a relatively simple solution for us.
We created an app to be used by our clients on android devices that we give them.
We would like the client to only be able to use our app and have limited access to everything else (i.e. settings, email etc.) What is the best way to achieve this without using 3rd party apps.
Thank you in advance!
This may not help but the L preview has a task locking feature included that may be of some insight, I'm not aware of how it functions as yet
Task locking
The L Developer Preview introduces a new task locking API that lets you temporarily restrict users from leaving your app or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android. Once your app activates this mode, users will not be able to see notifications, access other apps, or return to the Home screen, until your app exits the mode.
http://developer.android.com/preview/api-overview.html
Hope this helped
Suppress the Title Bar & Make Your App a Launcher
Root Your Tablet
Modify System Files and Settings to hide the soft keys
On the next link you can find the complete solution for the Nexus 7 (2012)
http://thebitplague.wordpress.com/2013/04/05/kiosk-mode-on-the-nexus-7/
simple Answer is:
Lock Install button with modify system settings.
Create your own customized-ROM and apply your requirement to that ROM.
more info, visit XDADavelopers
Android 8's battery consumption improvements are nice to the user but I am a bit afraid if my service will work as expected.
First of all: Thank you for any suggestions but I cannot just schedule my service. I want to make a OK Google-like keyword listener running in the background all the time. It will be based on the open source pocketsphinx-android library. I know that this will consume much battery power and I will inform the user about this.
Can we create a permanent background service on android 8+ ? I need to target android 8 in gradle because I was expecting some bugs with older targets. I also don't want to annoy a user with a foreground service which permanently shows a notification in the status bar.
[https://developer.android.com/about/versions/oreo/background.html] - Is there really no way of making permanent background services for my use-case (but preferably for all use-cases) possible?
Unfortunately, it's not possible to use a background service and don't show a foreground notification on Android 8.0 and higher.
The only one way that it might work is if you stick your app to Google APIs such as Voice Actions API.
As far as I know there is no a good work around and most apps like WhatsApp are still targetting Android API 24.
For what is worth, I am sharing me experience on that:
It's partially possible to use a background service and not showing a foreground notification on Android 8.0 just made some experiments and ended up with this:
Just create a notification channel with IMPORTANCE_NONE, and the notification will still exist, but will not be displayed in status bar.
Code excerpt:
NotificationChannel channelService = new NotificationChannel(
YOUR_SERVICE_CHANNEL_ID,
YOUR_CHANNEL_HUMAN_READABLE_NAME,
NotificationManager.IMPORTANCE_NONE);
channelService.setSound(null, null); // let's be quiet : no sound
channelService.setLockscreenVisibility(Notification.VISIBILITY_SECRET); // not on lock screen
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
// changes needs to uninstall app or clean app data, or rename channel id!
notificationManager.createNotificationChannel(channelService));
This way, the notification will not be displayed when your app is running in foreground.
Not a perfect solution:
When your app goes in background (i.e., you open another app), the "Android system" app displays a notification about "(your) app being running in the background".
So, this is not great, but, from my point of view, it's a bit better than before.
just wondering if anyone has managed physically to use an Android tablet to control an external screen via and HDMI cable. The Android tablet should have the Presentation APIs, so a version > 4.2m and an HDMI (or mini HDMI) port.
https://developer.android.com/reference/android/app/Presentation.html
So far we have tested with a tablet that has Android v5.1.1 and a mini HDMI port, but as soon as we connect the external monitor, the tablet monitor shuts off (but it is still responsive to touch) and all the output goes to the external monitor.
The tablet is a HannsPad Titan2 13.3 inches.
So we are still stuck on the physical setup. It this does not work at least with mirroring, how can we be expected to start tinkering with the presentation API?
So we are looking for confirmation from other coders that the setup is at least physically been done and tested at least once..
Thanks
W
as soon as we connect the external monitor, the tablet monitor shuts off (but it is still responsive to touch) and all the output goes to the external monitor
That was an incompatible and unfortunate choice made by your device manufacturer. The screen should remain on. You might rummage through Settings to see if there is a way to configure this behavior, or contact the device manufacturer for support.
The tablet is a HannsPad Titan2 13.3 inches.
Buy a better brand next time.
It this does not work at least with mirroring, how can we be expected to start tinkering with the presentation API?
Buy a different tablet. Note that (micro-)HDMI connectors seem to be less common, though some tablets might also support MHL or SlimPort.
Or, in Settings > Developer options, choose "Simulate secondary display" to give yourself a floating window that serves as a fake external display that Presentation can drive (except perhaps on Android O). For development purposes, this works for light testing.
So we are looking for confirmation from other coders that the setup is at least physically been done and tested at least once.
I have never used that tablet. However, the Presentation APIs work just fine. For example, I was just updating my CWAC-Presentation library yesterday, and part of that testing included trying my demo app on a Nexus 10 connected to a micro-projector via its micro-HDMI connector.
I'm using a SG Note 4 and when I open the Google Maps app and then go to task manager it never shows up, it does when you go to settings, applications, cached..., how can I achieve the same with my app. Im using a map fragment and when moving the camera the cache increases and increases, I imagine people with little knowledge going to task manager and seeing my app using 500mb of ram might end up getting scared and kill it, or worse uninstalling it. Maybe not all manufacturers give users this option but for those that do how can I do this if it's even possible thanks!!
Does anyone know if PushLink can do silent updates? That is, download the app and install it without any interaction from the user?
The PushLink website is quite sparse on documentation regarding features available so I can't be sure.
Or does anyone know if it's possible to have a silent installer for android? I basically have android devices that will not do any user interaction and I need to be able to update my apps running on them.
Yes, it is possible since version 3.1.0 released at 2012.04.23.
Take a look at NINJA strategy
NINJA (Only for rooted devices) The application is just re-launched in
a new version. There isn't notification. BETA!
There's no official way to install anything on Android device without user interaction. Which is a good thing, because it prevents a lot of possible malware and exploits from working.