关闭 Android 操作后佩戴通知且没有小图标

Dismiss Android Wear notification after action and no small icon

两个问题:

我的代码:

int notificationId = 001;

// Reply action
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("google.navigation:///?q=48.193479,11.569957&mode=w"));
PendingIntent actionPendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

// Create the action
     Notification.Action action =
new Notification.Action.Builder(R.drawable.map_white,
"Open Navigation", actionPendingIntent)
.build();


Notification notification =
new Notification.Builder(getApplicationContext())
    .setPriority(Notification.PRIORITY_HIGH)
    .setSmallIcon(R.drawable.map_icon_notification)
    .setContentTitle("Navigation Notification")
    .setContentText("Please swipe left to start navigation.")
    .extend(new Notification.WearableExtender().addAction(action).setBackground(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.background_notification)))
    .setAutoCancel(true)
    .build();


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

notificationManager.notify(notificationId, notification);

关闭通知

notificationManager.cancel(notificationId)

在AndroidWear中,通知图标显示你的APP图标

AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"  <--- change this
    android:label="@string/app_name"
    android:theme="@style/AppTheme">