Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.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
Android 通知未在值班时出现_Android_Android Notifications_Wear Os_Android Wear Notification - Fatal编程技术网

Android 通知未在值班时出现

Android 通知未在值班时出现,android,android-notifications,wear-os,android-wear-notification,Android,Android Notifications,Wear Os,Android Wear Notification,我正在我的应用程序中创建以下通知: int notificationId = 001; NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.icon) .setConten

我正在我的应用程序中创建以下通知:

        int notificationId = 001;

        NotificationCompat.Builder notificationBuilder =
                new NotificationCompat.Builder(this)
                        .setSmallIcon(R.mipmap.icon)
                        .setContentTitle(StationUtils.getStationModeString("My Notification")
                        .setContentText("Good Notification");

        NotificationManager mNotifyMgr =
                (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        mNotifyMgr.notify(notificationId, notificationBuilder.build());

        NotificationManagerCompat notificationManager =
                NotificationManagerCompat.from(MainActivity.this);

        notificationManager.notify(notificationId, notificationBuilder.build());
它出现在我的手机上,但不出现在连接到手机的手表上。Android Wear所需的代码中是否缺少某些内容?它必须是版本签名的构建吗?我检查了设置,手表可以访问通知


谢谢

如果您使用的是Android 5.0,请确保中断设置未设置为
“无”