wear-os

How to set layout for topEmptyRegion in WearablListView?

柔情痞子 提交于 2019-12-04 09:16:23
The "Disconnected" region is the top empty region thats scrolls up when this listview is scrolled. How do I set layout for that? Thanks. Looking at your example using the hierarchyviewer it is implemented like this: A RelativeLayout holds the WearableListView <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/llist" android:orientation="vertical"> <android.support.wearable.view.WearableListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match

How to record audio on android wear

半腔热情 提交于 2019-12-04 08:54:10
问题 There is some way to record audio on android wear? I used AudioRecord API and it crashes the application. Am I doing something wrong? short[] audioData = new short[minBufferSize]; AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, 11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, minBufferSize); audioRecord.startRecording(); while(recording){ int numberOfShort = audioRecord.read(audioData, 0, minBufferSize); for(int i = 0; i < numberOfShort;

Using GoogleApiClient from Push Notification IntentService to Send Data to Android Wear

回眸只為那壹抹淺笑 提交于 2019-12-04 08:36:31
This is a follow up question to... Android Wear Bundled Notifications and Background Images I'd like to create a Android Wear GridViewPager layout that get's created when a new push notification comes in. Below is my code that initializes a GoogleApiClient connection when a new message comes in so I can then send data to the wear app which then creates the GridView Pager. My problem is that the GoogleApiClient never gets a connection. I've successfully run the SynchonizedNotifications sample app in the sdk folder so I know my device and watch are paired correctly. Below is current code...

detect whether wear app started with voice command or touch input

▼魔方 西西 提交于 2019-12-04 08:36:25
In my wear app I would like to show different layout options based on whether app is started via a voice command or via a touch input. But I could not find any way to do this in docs. The only possible way I can think of is to have two launchers. But I am looking for rather direct solution than creating multiple launchers. After checking the activity log a bit, I found this: When you click on an app in the Android Wear, this is logged: I/ActivityManager(446): START u0 {act=android.intent.action.MAIN flg=0x10000000 cmp=com.lge.wearable.compass/.MainActivity} from uid 10002 on display 0 When you

Android Activity Recognition on Wearables

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 08:15:48
I'm researching ways on how to do activity recognition using an android smartwatch. Currently, I'm focusing on detecting whether the user is walking or standing still. My first idea was to use the built in step counter, but then I came across the Android Activity Recognition API (I'm relatively new to Android^^) which seems to be used in mobile apps only. I'm now stucking at answering the following questions: Is the current API already making use of a connected wearable device? (e.g. automatically accessing built-in wearable sensors) Is there a seperate API available for Android Wear? Is there

Android Wear CapabilityApi cannot find handheld capabilities

北战南征 提交于 2019-12-04 07:42:25
I'm attempting to use MessageAPI to communicate back and forth between my handheld app and wearable app. I can't get the communication to work. I can confirm the devices are connected, but when my code executes, it acts like neither app has registered the Capability I am requesting. notifications are successfully sent from handheld to the wear device Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await() returns a list showing the handheld or wearable is indeed connected Wearable.CapabilityApi.getAllCapabilities(mGoogleApiClient, CapabilityApi.FILTER_ALL).await() returns an empty list :-

How to open the main app from the wearable?

空扰寡人 提交于 2019-12-04 05:30:11
I'm playing a little with wearables, I already created notifications from my micro app (which runs on the wearable ) with some little restrictions and I'm wondering how I can create a pending intent for an action to open the main app on the phone. My solution that I've just tested and it works is add a message listener on the Android application and simply send from the wearable the details of what I want it to do. public class WearMessagesAPI_Service extends WearableListenerService { private static final String OPEN_APP_PATH = "/OpenApp"; @Override public void onMessageReceived(MessageEvent

How to Create a curved scrollbar in android wear 2.0?

旧街凉风 提交于 2019-12-04 05:18:44
I am using WearableRecyclerView to create a curved layout,but the default scrollbar is still vertical.Is there a way to create a curved scrollbar like android wear 2.0 launcher? The API was renamed to CurvedChildLayoutManager So use val layoutManager = CurvedChildLayoutManager(this) recyclerView.layoutManager = layoutManager PS: as for topic question, you dont need app:layout_box just use android:scrollbars="vertical" on your WearableRecyclerView https://developer.android.com/reference/android/support/wearable/view/CurvedChildLayoutManager.html Actually, the scrollbars are circular for any

What is the Uri for Wearable.DataApi.getDataItem() after using PutDataMapRequest?

风格不统一 提交于 2019-12-03 15:55:25
问题 I'm testing the Wearable Data Layer Api as described in the Android tutorial. There is a low level API based around DataItem, which can have only a byte array as payload, so the training recommends using PutDataMapRequest, which seems to be basically equivalent to a Bundle (i.e. a serializable map) when using Intents. You basically create an instance of this class, then fill the values, and send it. private final static String DATA_PATH = "/testdata"; PutDataMapRequest dataMap =

Programmatically determine screen shape in Android Wear

我怕爱的太早我们不能终老 提交于 2019-12-03 15:34:13
I'm looking for a technique to determine in Java if the Android Wear device screen is round or rectangular. Note that this isn't just about layouts; my code actually needs to know which shape it's working with, because they're handled differently. As far as I can see from code samples online, two different approaches should be possible - but I've been unable to get either of them to work. I'll include them here to eliminate them from the running, or for possible troubleshooting (if anyone can see the problem with them). Please don't refer me to another SO post that just reiterates the