Is there a way to remove some options from Android system settings? - java

I can't find a way to explain what I need using words, so I'll use images instead.
What I want is to have the user open Accessibility settings and enable Window Change Detecting Service, but I only want this service to appear, nothing else.
i.e: When the user is directed to accessibility settings by my app, instead of seeing this:
I want them to see this:
This is the original code:
Intent changeSettings = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(changeSettings, 0);

You are welcome to create your own build of Android that has a Settings app that looks the way that you want.
Otherwise:
Apps cannot control what options appear on that screen.
The exact set of options that appear on that screen will vary by device model and OS version. So, for example, the Samsung Galaxy S9 edition of that screen looks different:

Related

Android Settings permissions not not acting as they should

I need to ask for permission from the user. One of the permissions I need is ACTION_MANAGE_OVERLAY_PERMISSION and the other is Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION. When asking for it as you can see in the code below, it takes the user to the Settings screen so the user could tick the permission from there.
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, OVERLAY_PERMISSION_REQUEST_CODE);
On some Android phones and Android versions, it takes the user straight to the specific application setting (the app that it is called from) on other devices it opens up the list of applications from which the user has to find the app and then tick the permission. In most cases on Androids lower than 10 it opens up the specific app settings window and when it's 10 or higher, it opens up the list.
Is there a way to make it consistently open the current application setting that is open?
I tried adding:
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("package:" + getApplicationContext().getPackageName()));
But that did not help either.
And secondly, is there a way to ask for this and other Settings permissions without opening the Settings menu and instead of doing it in a dialog inside the application?
If not then is there a way to ask for multiple Settings permissions one after another because my application requires two Settings type permissions.
EDIT
Here is what I meant by the specific application settings vs the list.
On the left picture, all apps are listed and on the right picture the specific app is opened (happens if you click on the app in the list).
Now in some cases, it directly opens the right picture but mostly it opens the left. Is there a way to force open the right picture at all times?
Is there a way to force open the right picture at all times?
No.
The Settings app usually is modified substantially by the device manufacturer. They can do whatever they want. This includes ignoring the Uri or outright removing third-party access to this screen, where the latter is what the documentation is warning against:
In some cases, a matching Activity may not exist, so ensure you safeguard against this.
If you make your own Android firmware, you could ensure that this Intent action behaves as you want, for whatever devices run your firmware.

Add app launcher to android notification menu menu

I would like to add an option to launch my app video the android pull down menu/notification bar. I have attached screenshots of this:
Image 1 shows the pull down menu I'm referring to. Image 2 shows where I would like my app launcher to be. Is there any possible way of doing this using either regular Java for Android or the Flutter SDK?
If you mean that you are looking to add an option where you see "Huawei Share", "Screenshot", etc., that requires you to implement a TileService. I do not know whether Flutter supports this, but you can definitely implement one in Java or Kotlin.
This class implements a TileService, though the example is rather old.

Dark mode/Splash activity follows the system . Android Studio

I'm developing an app. I have implemented dark mode by creating colors-night file , using a switch and appCompatDelegate. I have written some code so that the app doesn't follow the system when phone's dark mode is on . And it works properly. Yet, the Splash screen does not obey and appears dark-colored when phone's dark mode is on(while the app continues light). I know this happens because the system reads the night resources before launching. (I figured it out since disabling dark mode in the onCreate method in SpashActivity or in Application does not work(and did some research) ). Adding "forceDark = false" on xmls doesnt work either. Does anyone know how to fix this?
I know it would be better to leave it this way since it is user's preference but i want on the first use, the user to see my company's colors and logo and then, choose the dark theme. Which, i also cant find how to change. I mean change dynamically splash activity's color depending on the sharedPreferences. (as i said before, doesnt work).
Thank you in advance :slight_smile:

Android / Java: Show GUI on "off-screen" (Always-On Display...)

I saw new Android devices coming out, that show things (clock etc.) once the display "turns off". That feature is called an Always-On Display, and since my Samsung Galaxy S6 edge already features an AMOLED screen, and a night-clock, I believe there is a way, to make it show something, when the display is "turned off". Is there a way using Java on Android, to display something, once display is meant to turn off? (Like just a normal GUI, I could do the rest then.)
Like, to tell your app, to show something, when the screen turns off, that is still visible somehow? (without root permissions)
That would be useful, thanks in advance.
UPDATE:
I found some apps on the Google Play Store, which seem do to, what I want (not that specialized though):
https://play.google.com/store/apps/details?id=com.thsoft.glance&hl=de
https://play.google.com/store/apps/details?id=com.orthur.always_on_display&hl=de
So it is definetely possible, I just need to know, how.
If you are not using root, then you can only use the Android APIs. Here is a list for example for the display: http://developer.android.com/reference/android/view/Display.html
I don't see anything there for the Ambient Display mode or Always-On.
Samsung provides APIs also for the features of it's phones here: http://developer.samsung.com/galaxy Here I can find the Look API that has something close to what you want, but for Edge.

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