我有一个从可穿戴设备开始的自定义布局通知,即仅在手表上可见。嵌入式活动在真实设备上成功运行,但不在仿真器上启动。拉起卡片以显示自定义通知时,我只会在卡片中找到一个黑盒子。通知从启动器活动发送。
在可穿戴方面以通常的方式启动:
// Build context stream notification
Intent notificationIntent = new Intent( this, NotificationActivity.class );
PendingIntent pendingNotificationIntent = PendingIntent.getActivity( this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT );
Notification.Builder builder =
new Notification.Builder( this )
.setSmallIcon( R.drawable.ic_launcher )
.setContentTitle( getString( R.string.app_name ) )
.extend( new Notification.WearableExtender()
.setDisplayIntent( pendingNotificationIntent )
);
NotificationManager notificationManager = (NotificationManager) getSystemService( NOTIFICATION_SERVICE );
notificationManager.notify( 0, builder.build() );
有人见过类似的东西吗?我只是好奇它是否是一个模拟器唯一的问题或更广泛的真实设备,因为我只有一个设备进行测试(三星Gear Live),这是正常的。