wear-os

How to request permissions from a Service in Android Marshmallow

依然范特西╮ 提交于 2019-12-17 02:13:06
问题 In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only Services. (Why is that, you might ask? The app has an Android Wear watch face bundled inside, and all the phone does is look up photos nearby to send to the watch - no Activity needed. But it does require location permissions.) So, is there any

How to request permissions from a Service in Android Marshmallow

╄→尐↘猪︶ㄣ 提交于 2019-12-17 02:12:10
问题 In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only Services. (Why is that, you might ask? The app has an Android Wear watch face bundled inside, and all the phone does is look up photos nearby to send to the watch - no Activity needed. But it does require location permissions.) So, is there any

How to detect when android wear device gets disconnected?

允我心安 提交于 2019-12-14 01:51:37
问题 I had an app that could detect when an android wear device disconnected by using a WearableListenerService and onPeerConnected / onPeerDisconnected . It seems these have been deprecated, so I am now trying to use onCapabilityChanged , but I cannot get this function called. I use this in my manifest for my service. Documentation on these features are not very good. <intent-filter> <action android:name="com.google.android.gms.wearable.CAPABILITY_CHANGED" /> </intent-filter> 回答1: So I finally

Can you use a WatchViewStub in a GridViewPager for Android Wear?

99封情书 提交于 2019-12-14 00:34:04
问题 I have a WatchViewStub that works fine on its own - it displays the correct layout on the appropriate square or round android wear emulator. But when I try and use the WatchViewStub in a GridViewPager it always displays the square (or rectangle) layout even on the round emulator. Is it possible to use the two together successfully? Here are some code fragments: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

Tutorials for Android wear apps

橙三吉。 提交于 2019-12-13 23:03:02
问题 Iam starting to learn to develop Android wear apps. But I need some tutorials to follow so that I get a better idea. Are there any tutorials which you could suggest? Thanks 回答1: Before you can develop anything for the wearable platform, you need to prepare your development environment by installing and updating all the packages you'll need, ensuring your Android Studio IDE is up to date. open the Android SDK Manager and check you have the latest versions of the following three packages: SDK

Does Android Wear work with geofencing without paired handheld?

a 夏天 提交于 2019-12-13 21:44:06
问题 According to the documentation, geofencing uses cellular network and wifi signal for detecting a location, but it seems like it doesn't work without a connected companion device. Does Android Wear work with geofencing without paired handheld? 回答1: Update: Just had a quick play with this, doesn't seem to work yet when BT disconnected and wifi connected. Original reply: Not all wear devices have the hardware to support this, though the LG urbane 2 has LTE and quite a few Wear devices support

Run App with Wear app without watch

我们两清 提交于 2019-12-13 21:31:48
问题 I want to make an app with optional wear app. If device has a paired watch, so install app on watch. But if not, the app mobile should works withou a wear. I created a project on Android Studio and select to create a mobile and wear app, but when the project is executed throw a error: Caused by: java.lang.IllegalStateException: Could not find wearable shared library classes. Please add <uses-library android:name="com.google.android.wearable" android:required="false" /> to the application

Making WearableListenerService onDataChanged() call on every PutDataMapRequest

别说谁变了你拦得住时间么 提交于 2019-12-13 21:10:34
问题 I want WearableListenerService to call onDataChanged() every time I make a request. I am aware that onDataChanged() is only called, well, on data change and not every time. I can add dummy data with the date to make this happen, but that feels patchy. Is there a more elegant way to achieve what I want to do? 回答1: You might be able to turn the situation around a bit. As you say, onDataChanged is only called whenever there's a change and you should probably keep handling that. Whenever you need

Android Wear detect ambient screen mode

六月ゝ 毕业季﹏ 提交于 2019-12-13 18:28:35
问题 Is there a way to detect when the watch is in ambient screen mode? I make a watch face and want to continue to update the clock when the ambient screen mode is on (clock is shown on screen), but I want to stop updating when the screen is off. For now, I start and stop the update in onPause and onResume methods, but the onPause method is called when the ambient screen mode comes on. Thanks. 回答1: To be notified of the Ambient mode changed, you have to use a DisplayListener . You can find the

Android Wear : Custom Notifications

戏子无情 提交于 2019-12-13 17:28:24
问题 In handheld devices, custom notifications can be displayed using RemoteViews . RemoteViews allows the developer to fully customise the notification. What is the way to do the same for Android Wear? Which class should be used to override the default notification UI with my own customised one? 回答1: if you want to customize text only, you can use SpannableString. It allows you to change color, background, align of your title/content text. if you want to create totally different notification you