android – setGroup()未定义NotificationCompat.Builder类型?

android – setGroup()未定义NotificationCompat.Builder类型?,第1张

概述我喜欢为我的消息应用程序提供stck类型通知,这是一个webapp. 我的通知正在运行.但每次收到新通知时,先前的通知会消失,新的通知会出现.当我用Google搜索时,我发现可以使用setGroup.但是,当我使用它时,它表明了这一点 对于NotificationCompat.Builder类型,未定义setGroup(). 我的通知功能是: public void CreateNotificat 我喜欢为我的消息应用程序提供stck类型通知,这是一个webapp.
我的通知正在运行.但每次收到新通知时,先前的通知会消失,新的通知会出现.当我用Google搜索时,我发现可以使用setGroup.但是,当我使用它时,它表明了这一点

对于NotificationCompat.Builder类型,未定义setGroup().

我的通知功能是:

public voID CreateNotification(String msg)    {        Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),R.drawable.icon);    Intent notificationIntent = new Intent(AndroIDMobileAppSampleActivity.this,AndroIDMobileAppSampleActivity.class);    PendingIntent contentIntent = PendingIntent.getActivity(AndroIDMobileAppSampleActivity.this,notificationIntent,0);     notificationmanager notificationmanager = (notificationmanager) AndroIDMobileAppSampleActivity.this                .getSystemService(Context.NOTIFICATION_SERVICE);    Notification noti = new NotificationCompat.Builder(AndroIDMobileAppSampleActivity.this)                        .setSmallicon(R.drawable.icon)                        .setTicker("New message from "+msg)                        .setWhen(System.currentTimeMillis())                        .setContentTitle("Mybuzzin")                        .setContentText(msg)                        .setContentIntent(contentIntent)                        //At most three action buttons can be added                        .setautoCancel(true).build();         noti.defaults |= Notification.DEFAulT_SOUND;     noti.defaults |= Notification.DEFAulT_VIBRATE;     noti.flags |=Notification.FLAG_SHOW_liGHTS| Notification.FLAG_auto_CANCEL;         notificationmanager.notify(notifyID,noti);}
解决方法 我有同样的问题,但经过几个小时和许多其他问题我解决了它.我假设你也在使用Eclipse,否则解决方案会有所不同.

你必须在SDK管理器中更新你的androID.特别是AndroID SDK Build-Tools,之后你必须安装API20.
现在您必须按照此处所述更新您的ADT:https://stackoverflow.com/a/24437737/2061089
更新后的工作现在不用担心.在安装更新之前,必须删除要更新的所有组件.

重新启动eclipse后,您只需更新项目中的所有支持(v4,v7和v13)包.取决于您使用的是什么.

成品.现在一切都是最新的,并且eveything正在运行.

希望能帮助到你!

总结

以上是内存溢出为你收集整理的android – setGroup()未定义NotificationCompat.Builder类型?全部内容,希望文章能够帮你解决android – setGroup()未定义NotificationCompat.Builder类型?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1125299.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存