大佬教程收集整理的这篇文章主要介绍了如何指定Android Wear上未显示通知操作?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
>手持设备上显示原始NotificationCompat.builder上添加的操作.
> WearableExtender上添加的操作显示在Android Wear设备上.
见Specifying Wearable-only Actions:
因此,要创建仅限手持设备的操作,请在创建扩展程序之前添加它们.要进行仅可穿戴动作,请在扩展器上添加它们.如果您使用扩展器并且想要在两个设备中重复操作,则必须在两者中添加它们(尽管可能有复制它们的选项?).
例如:
NotificationCompat.builder notificationBuilder = new NotificationCompat.builder(this) .setsmallIcon(R.drawable.ic_launcher) .setContenttitle("The title") .setContentText("This is the text") .setContenTintent(pendingIntent); // HandHeld-only actions. notificationBuilder.addAction(drawable1,"In Both",pendingIntent); notificationBuilder.addAction(drawable2,"Only in phone",pendingIntent); // Wearable-only actions. NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(); wearableExtender.addAction(new NotificationCompat.Action.builder(drawable2,pendingIntent).build()); wearableExtender.addAction(new NotificationCompat.Action.builder(drawable3,"Only in wearable",pendingIntent).build()); notificationBuilder.extend(wearableExtender); // Build and show notification. notificationmanagerCompat notificationmanager = notificationmanagerCompat.from(this); notificationmanager.notify(notificationId,notificationBuilder.build());
也
>如果您创建了WearableExtender但未向其中添加任何操作,则使用原始通知中的操作.>手持设备的“内容意图”似乎总是出现在手表上,带有“打开电话”文本.我还没有找到一种方法只为手表禁用此功能.
以上是大佬教程为你收集整理的如何指定Android Wear上未显示通知操作?全部内容,希望文章能够帮你解决如何指定Android Wear上未显示通知操作?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。