Open ACTION_USAGE_ACCESS_SETTINGS screen for specific Android App - android

I want ACTION_USAGE_ACCESS_SETTINGS for my app locker Android application without 2 steps navigation. I mean can I get it in background like media permissions or direct access to my app ACTION_USAGE_ACCESS_SETTINGS screen?

After digging around in the source code of the Android settings app I think that this is not possible. The screenshot you posted is the UsageAccessDetails Fragment and the only place where it gets created is on line 610 in the ManageApplication class right here, which in turn is in a method that only gets invoked by the onItemClick method of the ManageApplication class right here. So I think that the UsageAccessDetails Fragment only gets created when a user actually clicks on the app in the UsageAccessSettingsActivity of the Settings app.

Related

Create a self-stopping (self closing) no-UI Android app

I want to create an android app which does one thing (change a setting and save that it did that) and then stops (exits? Stops ? gets destroyed?) before a form is loaded or shown.
Then when I run the app again, I read wether the app has chaged the setting, and then undo's that and then stops (exits? Stops ? gets destroyed?) before a form is loaded or shown.
You can compare it with an existing flashlight app: you click the icon and the flaslight (led) goes on (and no form is shown) and when you click the icon again, the flaslight (led) goes off.
Sounds easy, but I'm not sure I how to do this. Looking at the activity flow (http://developer.android.com/reference/android/app/Activity.html) didn't really help....

Setting app icon on home(main) screen default

i'm working on an sms management application, it works instead of native android sms manager but i want to show my app on home(main) -i mean 1st screen-programatically.My application now seems on 6th screen and diffullt to reach to write a message.How can i put my app on home(main) screen?
I think you just need to move the app starter to the desired place. Moving an app starter can be done with long click on the app starter icon and then move it to the right place.
If a new android application is installed it automatically places it to the end of the app list on your phone. You have to move it then manually...
I agree with Lorenz, you cannot force your application to specific place in application list.
But you can add a shortcut to Home Screen whenever you launch the application, so that application is always accessible from HOME.
Try this for adding shortcut.

What can I do to protect my launcher from exit?

I'm developing a home replacement application for kids. The user can't exit from the app (for example to open another application such as Settings) without a password.
What can I do to obtain this behavior?
I guess:
I should block the back button (done).
I should block the "recent apps" button (done but it's unstable)
I should block the access to the notification bar (is that possible? How?)
...?
I have spent the last 6 months developing this kind of application. The sad answer is, none of the above is fully possible. Android does not allow an application to meddle with things like notification bar, HOME Button or factory-reset resistance.
The only way to ensure you will be able to control all these things is to have a system signature, but it is only granted by the manufacturer for a selected phone model.
You can also try rooting the phone and meddling with the system config files directly, but it is rather dangerous.
You can hide the notification bar by using
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
With these the activity goes on fullscreen and should hide the notification bar.
However this works only for activity where you use it, so if you want to make it work for he entire app i suggeste you to put this inside the onCreate of a class that extends Activity and then make all of your activity extends this class.

Launch one activity from another

i just want to know how can i detect if the user opens an app so an activity of mine launches as well.
For example, the user opens the sms app and right after a kind of lockscreen appears.
You can create a service which will run int the background and you can use this API to determine which activity is visible. That's how many app lock works.
As far as I understand the Android system, it is not possible unless you are making a custom firmware.

Force application to front

The question I'm about to ask may seem dangerous for the user, so here's the story before the question:
I'm working in a compagny that tries to sell Galaxy Tabs to schools (children under 10). So, I've been asked to develop an application that starts on boot showing a login screen. The child HAS to log in before he's allowed to use the tablet (just like logging in a computer).
My application starts on boot, shows the login screen, all buttons are blocked (the kid must not be able to use the tablet before the application lets him) except the home button.
fortunately, it seems impossible to block the home button.
I've been trying to rebring the application to front when onpause/onstop is called, this kind of hacks.
So my question is : Can I prevent an user to quit my application until I let him do so?
I know this sounds like a virus, I'm not really happy to be looking for this kind of solution either.
You have to build a custom Home screen, and then set it as the default Home application.
EDIT: see more on this previously asked question (at How can I create a custom home-screen replacement application for Android?). You can just make your authorization the default Home application, then when they log in it forwards to the regular Home screen. If they hit the home button your app gets called, can check if they have logged in and if they have will just send them to the regular home screen.

Categories

Resources