Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Android Wear设备上显示我们的应用程序通知_Java_Android_Notifications_Push Notification - Fatal编程技术网

Java 在Android Wear设备上显示我们的应用程序通知

Java 在Android Wear设备上显示我们的应用程序通知,java,android,notifications,push-notification,Java,Android,Notifications,Push Notification,我想在Android Wear设备上显示我的应用程序通知。为此,我创建了一个新通知,如下所示 Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender().setHintHideIcon(tru

我想在Android Wear设备上显示我的应用程序通知。为此,我创建了一个新通知,如下所示

Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
    NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender().setHintHideIcon(true).setBackground(bmp);
    Notification notif = new NotificationCompat.Builder(mContext).setContentTitle(title).setContentText(msgText).setSmallIcon(R.drawable.ic_launcher).extend(wearableExtender).build();
    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mContext);
    notificationManager.notify(notificationId, notif);

但我在设备上收到两个通知。请任何人提供帮助。

无需为android wear创建单独的通知。您的设备通知将自动出现在android wear上。简而言之,你不需要做任何事情。

你确定我们不需要为android wear设备创建单独的通知吗??“当android手持设备(手机或平板电脑)和android wear-able连接时,手持设备会自动与穿戴设备共享通知。”这是