Keep android app in foreground unless in in settings - java

I have an app for a customer (refer to it as "their" app). When "their" app is open they do not want users of the device to use any other apps.
The only way they want to get round this, is if i create a login page within the app, and from there you can go to the android settings page. If the android settings are accessed, then the user should be able to go anywhere they want, until "their" app is in the foreground again, then the device should be locked into using just that app.
If this makes any difference, "their" app is a cordova app. I dont think it will, but thought i would mention it anyway. Needs to work in android 5.0
Is this possible at all? What would i need to implement for this? A service and timer?
UPDATE
It is a tablet, so it will never ring.
If the user presses the Home button, nothing should happen as the app should stay in the foreground

Related

Can I make a Notification to specific apps on Android Studio?

I'm making an app that relies on the content of an specific group of apps.
I want to know if it's possible And I want to make a notification when the user opens one app of that group just to remind him to update my app.
I want to know if it is possible somehow to list these specific apps. For the notification not to appear in all apps.
I don't have much experience on Android Studio. And I never made a notification system on my apps.

Check if an app has been opened and recive some alert about it

I’m working on an app that can "disable" another apps for a limited time. In the first activity the user can choose which application he wants to disable, then my application needs to check if the chosen apps have been opened. If so, my app needs to detect it and show the “disabled app” activity of my app instead.
My problem is how my app can detect that the disabled app has been opened.
I looked for solutions and found this one and this one, but they were removed.
Thank you!
There is an API you can use to query events about apps (packages) but it requires an additional 'special access' permission . Have a look at UsageStatsManager

Opening app from background Android

I have created an Android app that I am also running on BB10 devices. It has some functionality regarding call logs, but one of the most important functions is that the app has to open (assuming it's in the background currently) whenever a phone call has ended. Worded differently, it needs to foreground itself whenever a phone call has ended. I currently have it creating a dialog that opens within the app, but it will not appear until the app has been manually foregrounded. I do not have a requirement as to how it opens itself, but I do need a yes / no dialog to appear when it does.
Is there any way to have the app auto-open itself? Or is that not possible?

How to Restrict access to phone's basic features, no one can uninstall my app, complete lock down?

Recently my employer asked me to build an app which is to be deployed on the field (for field workers) having features such as:
-when the phone starts the app should automatically fire up and no one is able to make use of other phone's features such as calling, texting etc.
Also, the app should be as such that it cannot be uninstalled.
Imagine a complete restricted access to phone's features except my app; a total lock down situation?
So, how really can I go about this? Will I need to build a whole new custom ROM loaded with my app? Or will I have to make use of app's "permissions" to lock down the system? Which is better?
Where should I start?
My app has to make use of SQLite, GPS, Wifi/2G/3G network and camera access.
Any advice would be appreciated.
Thanks
U can create an application which will be listening for Activity starting event. When u catch this event u can start your own activity. This activity will suppliant uninstall activity. To catch event - use logcat reading
or
If your are going to launch your own android phone, put your application in the android source, like the other native applications like Myfiles, Gallery. and
modify the source, so that in Settings --> Manage Applications there
is no entry for your application.
First of all I should say such a horrible plan
you can not prevent system to uninstall your application. According to your client's requirement you can only do one thing. That is to launch the application when the phone is started by using BOOT_COMPLETED intent filter

Home button brings back to my app

I am making a car launcher application, which contains shortcuts to other apps, when i'm in another app i'd like to press the home button and go back to my launcher
So basically i need to override the home button outside of my app,the override has to work only when my app is opened in the background so when i close my app the home button will work as usual taking you to your default launcher
Can i implement something like this or i'm asking too much?
There is no way to intercept the home button on Android, unless you make your app the home screen. This is for security reasons, so that malicious apps cannot take over your device by overriding all the buttons that can exit. The home button is the one sure shot way to be able to leave any app.
In short, no it's not possible, and even if it were, it is a serious disruption in what a user expects out of an app's behavior.
If you go the route of making your app act be a replacement home screen you'll have to include in the install instructions for the users to set your app as the default launcher.
Then the home button would take them to your app. In order to get it to switch back to the default launcher when they are not in "car" mode would be a bit tricky but you could prolly achieve it with some sort of fork activity that checks if car mode is enabled if so go to your car mode launcher if not go to the default launcher (it gets trickier if the user already has a different 3rd party launcher) So essentially your app will always be the home screen app no matter if car mode is enabled or not, but if it is not then you manually start the "normal" home screen.

Categories