wear-os

Where to declair the alarm manager for updating a watchface in ambient mode?

懵懂的女人 提交于 2019-12-11 13:59:58
问题 I'm trying to add an AlarmManager to update a watch face on half minute intervals. This is for a ternary clock. This is my first time programming with Java or android studio. I'm following a guide at https://developer.android.com/training/wearables/apps/always-on.html The guide says to "declare the alarm manager and the pending intent in the onCreate() method of your activity" Should I use @Override public Engine onCreateEngine() { return new Engine(); } or @Override public Engine

Android Wear DotsPageIndicator only fades when first created

笑着哭i 提交于 2019-12-11 13:23:13
问题 I have added a DotsPageIndicator to my GridPager which works fine. The only problem i am facing is the fade of the dots. When first displaying my ui the dots are visible for a brief moment and than fade away. When i swipe to a different page the dots reappear and from thereon out they don't disappear anymore. I have not touched the setDotFadeWhenIdle(boolean) property. Is there anything else i have to consider? 回答1: I had the same problem and I solved it extending WearableActivity and

Show more than 3 item in a wearable listview without scrolling

China☆狼群 提交于 2019-12-11 12:50:11
问题 I want to create a wearable listview that can show more than 3 item simultaneously, but the wearable listview only shows 3 item, and i have to scroll down to see the other items. Is this a WearableListView specific thing? So my WearableListView looks like this: But i want to show more than 3 item without scrolling, because it has enough space. The listview container xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout

Android Wear DotspageIndicator changing the color of selected dot

陌路散爱 提交于 2019-12-11 12:34:02
问题 I like to change the color of selected dot in wear's Dotspageindicator. I tried using setColor() and setSelectedColor() but the color is not changing still default behavior. I hope somebody can help me with this problem. 回答1: I got the solution the problem is setting color they are redrawing the view without updating the paint. To update the paint set the radius of the dot. It will redraw the view after updating the paint. 来源: https://stackoverflow.com/questions/34190595/android-wear

Android Wear Access Contacts

荒凉一梦 提交于 2019-12-11 12:28:53
问题 I have an app that interfaces extensively with the contacts ContentProvider . I am looking to introduce a Wear component to my app that will make use of contact data. Is Wear able to directly access the contacts through a ContentResolver or does it have to be manually synced from the mobile device? 回答1: There is no such an API allows you to directly read contacts of your phone. You may have to consider the wearable app as a separate app from you phone side app. You should sync the contacts

Connection Refused in WearableListenerService / Android Wear when phone in sleep mode

旧城冷巷雨未停 提交于 2019-12-11 10:37:01
问题 I am developing an Android Wear Watchface that accesses the Internet by sending a MessageAPI request from wear to my mobile app, where I am running a WearableListenerService, and on my mobile app, I receive the request from wear in onMessageReceived, and in onMessageReceived I start an AsyncTask to retrieve an image from the Internet. This works all fine normally . However, if the phone is inactive for a few minutes (screen black, not connected to my mac via USB) I receive an "ECONNREFUSED -

WebView in android wear is giving errors when running

♀尐吖头ヾ 提交于 2019-12-11 10:26:41
问题 I am trying to make a web browser for android wear and I am using android studio. My code for the inflating. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { @Override public void onLayoutInflated(WatchViewStub stub) { webview = (WebView)findViewById

setCurrentItem after setting adapter on GridViewPager return NPE

风流意气都作罢 提交于 2019-12-11 10:26:31
问题 does anyone knows a better solution then waiting for a few milliseconds if you try to start with a given item on a GridViewPager in Android Wear like this one: pager.setAdapter(new MainGridAdapter(this, getFragmentManager())); Runnable dirtyHack = new Runnable() { @Override public void run() { pager.setCurrentItem(2, 0); } }; Handler handler = new Handler(); handler.postDelayed(dirtyHack, 100); The issue is described here and I ran also into it 来源: https://stackoverflow.com/questions/27127275

Send data and wait for the answers with the Wearable Data Layer API

最后都变了- 提交于 2019-12-11 09:03:38
问题 I have a wearable device from which data is sent to a handheld device wrapped in a DataMap object. On the handheld device I implemented a listener service that extends WearableListenerService implemented in this way: public class ListenerService extends WearableListenerService { private static final String TAG = ListenerService.class.toString(); private static final String WEARABLE_DATA_PATH = "/wearable_data"; @Override public void onDataChanged(DataEventBuffer dataEvents) { DataMap dataMap;

WearableCalendarContract query doesn't return recurring events

左心房为你撑大大i 提交于 2019-12-11 08:47:24
问题 I'm creating a watchface for Android Wear which will display calendar events. Based on this page (and the WatchFace sample provided in the SDK), I managed to query the next events for the day, and display them on my watchface (below is the code I use to query the events). The problem is that recurring events are not returned in the cursor, and thus are not displayed on the watch face. Is there any parameter to add in the query to get recurring events ? private static final String[] PROJECTION