wear-os

Android sensor sampling rate won't drow below 60 hz

痞子三分冷 提交于 2019-12-08 10:14:09
问题 I'm reading out the accelerometer sensor on a Sony Smartwatch 3. Since the Android Wear 1.5 update the sampling rate won't drop below about 60hz, regardless weather I use SENSOR_DELAY_NORMAL , SENSOR_DELAY_UI or SENSOR_DELAY_GAME . Before the update SENSOR_DELAY_NORMAL resulted in a sampling rate of about 18 samples/seconds. accelerometer.getMaxDelay() still returns 62500, which would be 16 samples/sec. I also tried setting the desired delay directly, when registering the sensor with

Voice input with Android Wear Preview

妖精的绣舞 提交于 2019-12-08 08:32:22
问题 I'm trying the new library to develop Android apps with wearable device (the Android Wear). I understood how the library works, now I'm trying to develop a notification for the code I found in this tutorial, but when I simulate a notification with a simply button it doesn't do nothing and I don't know why... I post here my code I hope you can help me to understand why it's not working: public class MainActivity extends Activity { private NotificationManager mNotificationManager; private int

Android Wear new (unwanted) permissions

家住魔仙堡 提交于 2019-12-08 05:49:00
问题 I recently switched from API 21 to 23 to create Android Wear watch faces. In the interest of brevity I will not comment on the excruciating process. (1) As I was uploading to Google Play I noticed that the new API has added, without my consent, 4 new rights: Required permissions 6 permissions (4 added) => android.permission.ACCESS_NETWORK_STATE => android.permission.INTERNET android.permission.WAKE_LOCK => com.google.android.c2dm.permission.RECEIVE com.google.android.permission.PROVIDE

How can I determine if I am running in Android Wear or not?

时间秒杀一切 提交于 2019-12-08 04:50:56
问题 I have a mobile and wear module in Android Studio and they are both using a 'core' code-base...in that core-code, how could I determine whether my code is running on a 'wear' of 'mobile' module? Should i use screen size? 回答1: Though this isn't officially documented (that I know of) you can determine whether the device is a watch or handheld by invoking either: getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); or by using: Configuration config = getResources()

Android wear doesn't start thread

时光怂恿深爱的人放手 提交于 2019-12-08 04:46:24
问题 I'm building an application with my team for a robot car to let it drive controlled by a mobile device. It works perfectly on my phone, but now that I've ported the app to Android Wear, the thread that lets me connect to a server on my Raspberry Pi doesn't work. Is there a way to get this thread working? Code: public class SocketConnect { static DataOutputStream dOut; static Socket socket; public static void connect() { System.out.println("Got to Connect"); new Thread() { public void run() {

Android wear activity onKeyDown is not getting called

风流意气都作罢 提交于 2019-12-08 04:40:30
This is not a duplicate but a specific case to Android wear. I am trying to make Android wear app do something when certain gestures are performed. But I realized that the onKeyDown() event is not called at all. Any help or info I this regard is useful. Here is my simple code snippet. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gesture_ema); Log.d(TAG, "Inside on create"); //Show prompt window on top always getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + WindowManager.LayoutParams

Get Heart Rate from Android Wear using Google fit

断了今生、忘了曾经 提交于 2019-12-08 03:28:28
问题 I'm developing an app for Android (only for smartphone, not for wear) and I want to get the heart rate using googleApiClient (Google Fit) from smartwatch (Huawei Watch f.e.). I tried using Sensor API but wear is not listed as DataSource in Google Fit API . REQUEST_INTERVAL = 5; Fitness.SensorsApi.findDataSources(client, new DataSourcesRequest.Builder() .setDataTypes(DataType.TYPE_LOCATION_SAMPLE, DataType.TYPE_STEP_COUNT_CUMULATIVE, DataType.TYPE_DISTANCE_DELTA, DataType.TYPE_HEART_RATE_BPM)

Create a background service in android wear

早过忘川 提交于 2019-12-08 02:49:09
问题 I have been trying to create an alarm application for my watch for past few days. And unable to find any clue that how we can create a background service for android wear. Even I didn't find anything in the developer guide for android wear. But, I just want to create this application only for android wear and don't want to synchronize data from my cell phone. 回答1: Android Wear is based on the same architecture as regular Android phones. So if you want to create a background service, you do it

MediaRecorder throw “java.lang.RuntimeException: start failed: -2147483648” when trying to record audio on LG G Watch

天涯浪子 提交于 2019-12-07 22:10:35
问题 I am trying to record audio in my app on a LG G Watch. The following code throws RuntimeException with message "start failed: -2147483648" at the statement "recorder.start();". Wondering what I'm doing wrong here. I have tried a lot of different set of parameters, for example for AudioSource: recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); //-and- recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Also for OutputFormat I have tried recorder.setOutputFormat(MediaRecorder

Failure [INSTALL_FAILED_OLDER_SDK] when installing Android Wear sample app

冷暖自知 提交于 2019-12-07 19:10:40
问题 I followed the instructions at this link to create a simple mobile/wearable app in Android Studio. However, upon trying to run it I am getting the error "Failure [INSTALL_FAILED_OLDER_SDK]". My problem seems to be like the one asked at this link, however unlike that user the reddit post that is linked to didn't contain any information that helped me (it basically suggested to add < uses-sdk tools:node="replace" /> to the android manifest, but android studio didn't like the tools thing." My