wear-os

Android Wear detect “Mute”

好久不见. 提交于 2019-12-03 14:43:10
问题 How does an application check in on "Mute" status of an Android Wear device? All volumes seem t be 0 no matter what. Log.d("VOLUME - STREAM_SYSTEM", Integer.toString(audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM))); Log.d("VOLUME - STREAM_NOTIFICATION", Integer.toString(audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION))); Log.d("VOLUME - STREAM_RING", Integer.toString(audioManager.getStreamVolume(AudioManager.STREAM_RING))); gives me D/VOLUME - STREAM_SYSTEM(32598): 0 D

Android Wear Launcher

天大地大妈咪最大 提交于 2019-12-03 14:33:06
I am wondering how the Android Wear launchers like Swipify and Wear Mini Launcher intercept touch events on the android wear home screen . I have tried adding the onTouch and onClick listeners to the Watch View Stub in my app so far, but I can not figure out how to get touches that occur outside of my app. Nicolas POMEPUY In fact, the views are directly added in the WindowManager in a Service . You can take a look at this thread to understand how it works: Creating a system overlay window (always on top) Be careful, there is an issue in the Moto 360 system at this time as explained here: https

How to make HTTP Requests over WiFi directly from Android Wear?

走远了吗. 提交于 2019-12-03 14:04:45
how can I execute HTTP requests or open a socket on Android Wear? I used to think that's impossible but the Web Browser for Android Wear app says the folloing: "[..] works even when your phone is off if you have a smartwatch with Android Wear 5.1 and WiFi"*. I tested it and that app CAN connect the internet when the paired phone is powered off. Whenever I open a socket or try HTTP requests on Android Wear I always get a ConnectException saying failed to connect to http://foo.com (similar stack trace here ). So I'm doing something different then that app is doing and I'd like to understand what

Fragment in round Wear watch turning black in emulator/watch

北战南征 提交于 2019-12-03 13:42:29
Im getting a black screen on my Android Wear round watch (on square it works). Both layouts show up OK in the Android Studio layout design. Project to test: https://bitbucket.org/powder366/motoblack Im using the following code: public class MyFragment extends Fragment { ... @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View contentView = inflater.inflate(R.layout.my_fragment, container, false); ... Layout my_fragment: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com

How to wake up Android Wear when it is in sleep mode?

邮差的信 提交于 2019-12-03 12:46:12
When Android Wear goes to sleep mode (screen dimmed), some parts of my code are not executed. I use Timer in background service to trigger some actions, such as sending data from wear to mobile, but the data is not sent. It is sent when I tap the screen to wake it up. I also try to use Timer trigger a notification with vibration when the screen is off, but it doesn't appear until I tap the screen. In debug mode (either Bluetooth or USB), data sending and notification work fine. I suspect this is because when Android Wear is in sleep mode, its CPU works at minimum level because the Timer is

Showing Android Wear style AlertDialog

戏子无情 提交于 2019-12-03 12:30:11
I'm looking for a way to recreate the alert dialog in the Setting application of Android Wear: Which is swipe to dismissable. But instead, what I got is this: Just a barebone Android dialog. How can I show the AlertDialog in the Settings.apk style? (Which I think must be default for Android Wear application) I found no default way to do this, also setting a custom view to an AlertDialog did not look good. You can still try though, maybe a different Theme works. What I did was create a new Activity and create my own layout which looks like this: <?xml version="1.0" encoding="utf-8"?> <android

Adding extra images/icons to CardFragment (Android Wear)

我们两清 提交于 2019-12-03 12:25:50
问题 I'm looking at this sample image from Google, and trying to figure out how to implement something like this. It looks very similar to the standard CardFragment layout that takes a title, description and icon. But I see an extra clock image/animation on the left, which makes me think they use a custom layout. Is this possible to do with a standard CardFragment ? Or is there another convenience class that allows support for multiple icons? 回答1: I accomplished this by extending the CardFragment

Send message from wearable to phone and then immediately reply

会有一股神秘感。 提交于 2019-12-03 12:17:26
问题 I've been battling with the Android Wear Message API all day today and have finally accepted I need some help with this. My app is very straightforward. The Mobile portion consists of a MainActivity (which does nothing but display "Hello world" and a Service which extends WearableListenerService . The Wear portion is just a MainActivity with a single Button, and implements MessageApi.MessageListener . The idea is simple: press the Button on the Wear device which sends a message to the Mobile.

How do you prevent an Android Wear activity from having multiple instances?

痞子三分冷 提交于 2019-12-03 08:01:27
Sometimes, most of the time when my LG G watch closes the app automatically by going to sleep/dim mode, if I open the app again by going to the start menu there are two instances of the activity opened (when I slide one off the previous one is underneath). This never happens in a phone, is this how activities work in Android Wear? Should I "finish()" them in onPause()? Thanks. Have you looked at the android:launchMode attribute in the AndroidManifest.xml for the activity? perhaps android:launchMode="singleInstance" will help you out. http://developer.android.com/guide/topics/manifest/activity

Show ongoing notifications in Android Wear

元气小坏坏 提交于 2019-12-03 07:10:14
问题 I've been playing around with Android Wear and making some dummy apps. What I've noticed is that Android Wear doesn't seem to show the notifications that are ongoing,i.e., notifications with setOngoing(true) . Any way to show these notifications on Wear??? 回答1: On-going notifications will not show up on Wearable devices. Instead you have to implement a Wear App on the wearable and show cards from there. 回答2: barkside's answer is correct. I recently wrote an article describing the steps in