Default Device assistance app Android - android

Sadly, now we can no more map our apps to Long press home button Event. But, There is a settings page where it is possible to change the default device assistance app:
Default Device Assistance app on Samsung
Is it anyway possible to change the default device assistance app programmatically or even launch the settings page (via intent) to make the user change the setting?

Is it anyway possible to change the default device assistance app programmatically
Fortunately, no, for blindingly obvious privacy and security reasons.
even launch the settings page (via intent) to make the user change the setting?
Ideally, there would be an action in Settings for this, but I do not see one that looks like it is specific to the assistant.

Related

How to disable, or hide system settings programmatically?

I do not want the user to open device settings, so I need to disable device settings.
I found way to open settings
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
But I am looking for a way to disable it, how can I do that?
You can not disable system packages unless you make a custom rom. Besides that it is a huge security risk to allow developers to disable settings so the user can not stop the app.
You may create custom launcher with kiosk mode to achieve your target. Note that this approach requires some actions from your users.
Related links
https://developer.android.com/work/cosu.html
http://pvolan.blogspot.ru/2017/01/android-50-kiosk-mode-aka-super.html

Prompting User to Enable GPS

Correct me if I am wrong:
1) You cannot programatically turn GPS On/Off on all versions of Android. Maybe some previous versions, and some hacks, but not on all devices. It simply is not allowed.
This leaves only two options:
1) Use new Google Play Services to prompt user to change these settings.
One issue with this is what if you just want to allow user to turn on GPS,
but not WIFI? The resolver will give them options to turn on both. How
can you just turn on one but not the other?
2) Send user to the settings application by firing off an Intent.
Now with 1) User must have current google play services installed.
If not they can be prompted to install it via standard GPS dialog.
Ok, now for 2) Sending user to settings application. I have the following problem:
When I fire off this intent, they not only get to change the Location/GPS Settings but they can also hit the little back button within Settings app, and adjust all settings. Is there any way to prevent this? Anyway to bring up the Location/GPS Settings without the inner back button? Thanks.
You cannot programatically turn GPS On/Off on all versions of Android. Maybe some previous versions, and some hacks, but not on all devices. It simply is not allowed.
Correct, for obvious privacy reasons.
When I fire off this intent, they not only get to change the GPS Settings but they can also hit the little back button within Settings app, and adjust all settings. Is there any way to prevent this?
No.

How to set system app is not disabled?

How can I set a system app (my custom system app) to be NOT DISABLED?
Just like the Launcher or Settings that the "Disable" button is not enabled. So the user can't disable my system app.
Below is the Launcher's effect:
It's not possible for a third party application (like yours) to define itself as not being possible to disable- It's important that the user be able to disable any application on their system. If you find a way, that will be considered a security flaw, and it'll likely be disabled in the next release of Android :)
Launcher and Settings are special cases in terms of not being possible to disable, since disabling those would make it difficult/impossible for the user to maintain their own device (or to undo their decision, since they wouldn't be able to launch the settings Activity and re-enable it).

How to set my app as default home android?

I'm developing a Android application, and I would like that when it first starts it set itself as default action for Home button.
Currently this option is given to the user by the Android system only when he first press the Home button after running my app.
User don't want to click on check box as "Use by default for this action" it should be set by default my apps.
Thanks in advance.
This is not possible, and it is a good thing too.
Android allows users to choose their own defaults to prevent malicious apps from making themselves the default app to deal with an action, and hence protecting the user's data and device. If an app could set itself as the default homescreen or browser or call app etc. then it could steal the user's personal data and also potentially spoil or deny access to the device itself.
Due to the above reasons, this is not possible why the Android SDK, and I sincerely doubt that an unofficial means to do this exists.

Screen Lock password in android

I am developing an application where I have to change the screen lock password on a button click,can anybody tell me how can I do this.
If you are talking about the unlock pass word set in the device settings by the user then the answer is you can't.
If an application could change the unlock password/pattern without user interaction then these security features would be mostly useless. A rogue application could in theory lock the user out of their own device if this were possible.
Edit: if your aim is not to change this value without interaction but just to send them to the correct settings page. You might be able to do that some how. You'd want to look into what intents you can use to start the Settings Activities. But if you are developing this application for use by the general public I would strongly recommend you rethink having try to do anything with the users security settings. As a user if an application prompted and then sent me to the security settings page with the intention of having me change something in there I would immediately uninstall it.
Edit 2: I've never seen it until just now so I don't know for sure what they used to achieve that. Since it states that must be android 2.2+ though I would assume they are using the Device Administration APIs The docs seem to indicate that it can "Prompt user to set a new password." Which I would think means that it is just going to start the settings activity for them. It is not actually changing the password value by itself. This whole API is subject to user activation also. So even if you get installed on a device the user must explicitly "activate" your app before it is able to make use of any of the admin APIs
I am sure the only way this is possible is if you signed your APK with the device key. This way it could access API's that are limited to system applications. This isn't possible for a normal app, only one that is baked into a custom ROM or device manufacturer ROM when building Android from source.
I do not exactly understand what you are trying to do. If you wish to change the lock screen password programmatically, and your'e application is A device administration than you can call:
resetPassword method of DevicePolicyManager like this for example:
m_policyManager.resetPassword("bla bla", DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);

Categories

Resources