Android wear not show notification

后端 未结 3 626
不思量自难忘°
不思量自难忘° 2020-12-19 21:03

I\'ve probblem. My android wear emulator not show notification. Here is my code for mobile:

private void notifyToWear() {
        NotificationCompat.Wearable         


        
3条回答
  •  温柔的废话
    2020-12-19 21:37

    Try this:

    NotificationCompact.Builder notBuilder = 
                                       new NotificationCompact.Builder(this);
    notBuilder.setContentTitle("Title").setContentText("Text");
    WearableNotifications.Builder wearBuilder = 
                                     new WearableNotifications.Builder(notBuilder);
    Notification not = wearBuilder.build();
    
    NotificationManagerCompat manager = NotificationManagerCompat.from(this);
    manager.notify(0,not);
    

    I hope this will help you..

提交回复
热议问题