Change android settings programmatically - android

Can I click on NFC on/off button using robotium? I know NFC cannot be turned on/off programmatically unless the device is rooted. But if I raise a popup for the user to do so and then click on the on/off button.
Just wanted to know is it possible?

If I understand you correctly, you want to take the user to the NFC section of the Device Settings (via a Toast or something similar). If this is correct, then using Robotium you will be able to trigger and action the Toast, but once you are in the device settings, Robotium cannot make the actual selection.
Android Instrumentation actions are confined to a single package (the one under test).
Take a look at UIAutomater, this may help.

No, it's not possible do it programmatically withour rootet device. You only can show nfc/wireless setting to user.
Android: Changing NFC settings (on/off) programmatically

Related

Default Device assistance app 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.

How to use volume keys to open a activity when device is locked?

Hi all i want make app which run over volume key for example when we press the volume down key it turn camera open( when device is locked) similarly i want the same in my app.
I don't think that's possible
Those functionalities come from the factory OS you have, not from specific apps. The only way that could be possible is by rooting the device, in which case you may be able to listen to physical button clicks and modify their behaviour.
This page shows an application that can alter the buttons behaviour once the device is rooted, but again, this won't teach you how to do it, as again, it's not for the majority of the users and you'd need to root every device.

Android . Activating my application when some string was entered in some other application

I am trying to create a behavior where entering some string in any application will open my application.
I've tried looking around on how to listen for keyboard press or listening for text change, but I couldn't find my required behavior and I don't want to create a custom keyboard for this.
If this is not possible, what will be a good implementation for lunching my application as fast as possible while in the other application?
Answered before the requirement to "don't want custom keyboard"
The only viable way that I can think of is if the user was using a custom keyboard written by you. Custom keyboards can and do act as key-loggers and therefor could detect any key combination, or written word and allow you to execute your code when your conditions are met.
Rerfer to Creating an input method docs
How to open my app as fast as possible from another application?
Press home, launch your app by clicking on the launcher icon
But assuming you mean without doing that, you'll still need to monitor some event, say volume keys pressed or device being shaken for instance, or have you app be running already in the foreground such as what Facebook messenger does (or used to do, I don't know)
Related questions:
What APIs in Android is Facebook using to create Chat Heads?
Listen to volume buttons in background service?
How to detect shake event with android?
Demo of bubbles

How to disable Accessibility "TalkBack" in your application?

My application uses TTS (text-to-speech) Engine, and the conflict I am running into is that Accessibility Talkback settings override anything TTS tries to say. I would like to disable the phone's talkback option if using my application.
Is there some sort of permission to handle this? I have not been able to find anything.
I know it's late, but I had the same problem few days ago.
If you want to "ovverride" the TalkBack with your own TTS engine you can simply add:
android:importantForAccessibility = "no"
to each view inside your Layout.
Now you can call your TtsSpeak() method inside your Activity.
IMPORTANT: This does not turn off the TalkBack App, but it will allow you to have a little bit more control over your App.
That is not allowed unless the phone is rooted. The accessibility functions on the phone are not to be changed by a developer, as a blind person may need them to use the phone.
Lg P875: having tried out Accessibility mode, the phone locked me out from scrolling - thus unable access Availability facility to reverse process. Nothing in User manual.
By accident I found selecting Settings icon, tap twice followed by long push on same icon. The screen released and I was able to terminate Talkback key. All back to normal, no thanks to LG user manual

Any listener for system preferences in Android

I want to capture event when an user try to go into the preferences screen, so I can ask password for it. The reason why I try this, I am developing app for the disabled. I don't want them to touch system settings directly, just the permitted helper.
Is there any event listener or receiver for this?
Thanks in advance.
I don't think there is anything in the public APIs that will allow you to do this. Device Admin is probably the closest thing, but I don't think it does this exactly.
If you wish to implement this (and be certain that it will be effective) you'd have to modify the OS slightly on your devices.
One possibility that might work and is within the APIs is to create a replacement home screen that does not show the usual items in the menu. If you were to go this route you could "lock" the into your activity and simply provide them no way to go to the settings except with a password or something. This would be a lot of work though, and would require the user to set your application as their default home screen. And even with this on the newer devices you may run into the trouble because there is a settings button inside the notification pull down, which I don't think there is a way to block, even with a replacement homescreen.

Categories

Resources