Programmatically mute an Android wearable - java

I programmatically want to mute the entire watch. So I wanted to do these things:
1. Mute to on , so go into non vibration mode. Will manufacturers be able to add sound capabilities to watches? Otherwise I would also have to add muting of sound...
2. Screen always on , to off. It's a system setting. Can I change it programmatically?
I already tried for point one to use the MediaManager:
AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
I tried all other ringer modes also just to be sure and nothing seems to work and change anything in the emulator and on my real watch but nothing is doing the job...
A pebble watch has night or silent mode support... So I won't be that hard to do it on a wearable I thought.. Any ideas on this one?

Wear 5.0.1 has some ability! the SDK sample Watchface has a way to detect it. Look for WatchFaceService.INTERRUPTION_FILTER_NONE - RoundSparrow hilltx
from this question here: Android Wear detect "Mute"

Maybe with requestInterruptionFilter where fitler mode are:
INTERRUPTION_FILTER_ALL
NTERRUPTION_FILTER_NONE
INTERRUPTION_FILTER_PRIORITY

Related

How to change the Animation settings of a device in Android - Java?

I have recently seen about a feature Remove Animations in my Android 10 device. So, how can we toggle that setting programmatically in java. This is what i am talking about
Actually, we cant. We can only modify the settings related to the app and not the device. Specially we cant make changes in the Accessibility section.

Activate speakerphone on Android 10 and above

So, I'm working on this app where a phone call is made using the TelecomManager and I want to turn on the speakerphone programmatically when an event is triggered in the app.
The app is primarily not made for making phone calls etc, but there's a function that makes phone calls in certain events.
This works fine on android versions below android 10 using the following code:
AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
am.setMode(AudioManager.MODE_IN_CALL);
am.setSpeakerphoneOn(true);
am.setStreamVolume(AudioManager.STREAM_VOICE_CALL, am.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL), 0);
But this code doesn't seem to work on android 10 and above.
One solution is to have the speaker on by default when making the phone call, but I want to be able to toggle the speaker via events in the app.
Does anyone have a solution for this?
Edit:
The application is only making a call to a specific number in case of an emergency and is not a phone app. And I'd like to be able to start the speaker without having to make the app into the "Default Phone App".

Problems with turning off the autofocus on Android phone

Working on my Samsung S6 camera calibration as a first step for further app development.
One of the perquisites for correctly working app is that the autofocus is disabled.
I used something like this:
mCamera.cancelAutoFocus();
Camera.Parameters mParam = mCamera.getParameters();
mParam.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
mCamera.setParameters(mParam);
Previously, I checked that the "infinity" focus mode is available on my device.
Still, when running the app, I can clearly see that the focus is changing depending on the distance of the object in frame. "Fixed" mode is not available.
Am I doing something wrong?
I just want to have focus that will not change while running app.
I'm using OpenCV3.1 with Android Studio.
Olivier's answer helped me alot.
Did it as it is described.
Had to edit layout a bit.
Put the setInfinityFocusMode under the onCameraViewStarted.
Thanks Olivier ! ;)

Does Android have an Internet status turning circle in the top bar like the iPhone has?

The iPhone has this swirling icon, which you can make appear when the Internet is working behind in the background. It's a VERY simple call to turn it on/off.
Does Android have anything like this? How do I call it and how does it work?
You should display this in the ActionBar.
The simplest way
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
Or using ActionBarSherlock for backwards compatibility
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setSupportProgressBarIndeterminateVisibility(true);
No, i haven't seen it on android yet. However with ICS and above, we see 2 arrows accompanying the WiFi or 3G to indicate if there is activity on the network. However it may not be possible to programmatically control it.
You could otherwise use a indeterminate progress bar within your activity to show background work.
You could try using Android Notifications and use an AnimationDrawable. Check this answer. (Note that I haven't tried it).

SlidingTab on Lock Screen vibrates when unlocking - regardless of the global settings about haptic feedback

When unlocking my android 2.3.3 phone at the simple lock screen it vibrates once the slider is touched and a second time a little longer when the slider has been pulled completely to the other side.
I found it a little annoying and so I thought I could somehow switch it off in the settings as I can switch off any other vibration.
There are actually two categories which might make sense in this case:
1) Sound Settings/General/Vibrate with the individual settings: (always, never, only in silent mode, only when not in silent mode)
2) Sound Settings/Feedback/Haptic Feedback (on/off)
I had to find out, that none of these settings have an impact on the unlocking action mentioned above.
So I googled and found some comments about the fact, that the vibration cannot be switched off easily in the settings.
e.g.
http://code.google.com/p/android/issues/detail?id=34040
Now I got curious and I tried to dive in a little deeper into the android sources and found the source for the slider here: https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/SlidingTab.java
see:
vibrate(VIBRATE_SHORT);
and:
vibrate(VIBRATE_LONG);
It seems to me that the vibrate action is called regardless of any settings.
Now I have some questions:
Shouldn't the vibration for unlocking consider the settings from either 1) or 2) above?
How would this be added to the source code and how would this change be applied to the android source repository so that some time later this could be migrated into the next android (if the sliding tab is used there at all)
Would it be possible to update the file SlidingTab.java seperately and test it on my rooted device or would it be necessary to do the complete make for the whole android system and flash my mobile phone with the new system in order to see if it works?
I have found other mobile phones with the same slider and no vibration when unlocking. I am clueless how this can be after I found the prove that it is not able to switch off the vibration in the source code.
thank you for sharing your knowledge with me
Nils
It may be consider or may not.
Not sure here.
If you need to change lock screen at all you can find various implementation. If you need to change default lock screen you need to build entire system.
Every companies customise Android for the phones. Therefore some sliders may have no vibration. Or the phone may have no hardware for it.

Categories

Resources