在可穿戴模拟器上看不到可穿戴通知



我创建了一个简单的应用程序。这将是手持设备和可穿戴设备的通知。以下是创建通知的代码

@Override
public void onClick(View v) {
    int notificationId = 001;
    // Build intent for notification content
    Intent viewIntent = new Intent(this, MainActivity.class);
    PendingIntent viewPendingIntent =
            PendingIntent.getActivity(this, 0, viewIntent, 0);
    NotificationCompat.Builder notificationBuilder =
            new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("title")
            .setContentText("Location")
            .setContentIntent(viewPendingIntent);
    // Get an instance of the NotificationManager service
    NotificationManagerCompat notificationManager =
            NotificationManagerCompat.from(this);
    // Build the notification and issues it with notification manager.
    notificationManager.notify(notificationId, notificationBuilder.build());
}

我可以在手机上看到通知,但可穿戴模拟器并没有显示任何通知。

我遵循了以下步骤

  1. 创建可穿戴模拟器

  2. 已从Play商店安装安卓穿戴应用程序。通过USB 将手机连接到桌面

  3. 使用"Android穿戴"应用程序中的"连接到模拟器"选项。演示卡可以在可穿戴模拟器上正确显示
  4. 在手机上安装了我的应用程序(上面的代码)。已触发通知。通知显示在手机上,但不显示在模拟器上。我观察了日志,但它也不例外

我是不是错过了什么。应用程序的迷你Sdk级别:8应用程序的目标Sdk:21

我遇到了同样的问题,解决方案是在设置->安全->通知访问中,检查Android Wear以允许它读取所有通知。