android-wear-notification

Can Android Wearable apps detect the power button as a KeyEvent?

↘锁芯ラ 提交于 2019-12-01 21:56:26
Can Android Wearable apps detect the power button as a KeyEvent or by other means? I would like to run a listener service to detect the wearable power button. I tried this but no log corresponding to a KeyEvent occurred. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.e(">>>>>>", "FindPhoneActivity event "+event); if (keyCode == KeyEvent.KEYCODE_POWER) { // Do something here... Log.e(">>>>>>", "FindPhoneActivity onKeyDown"); //event.startTracking(); // Needed to track long presses return true; } return super.onKeyDown(keyCode, event); } I have also experimented with two

Android: Grouped notifications and summary still shown separately on 4.4 and below

时间秒杀一切 提交于 2019-11-30 03:10:50
I want to implement stacked notifications on Android Wear To do that I create 1 summary notification and N individual notifications for each "item". I want only the summary to be shown on the phone. Here's my code: private void showNotifications() { NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); showNotification1(notificationManager); showNotification2(notificationManager); showGroupSummaryNotification(notificationManager); } private void showNotification1(NotificationManager notificationManager) { showSingleNotification