果冻豆:该方法setPriority(INT)是未定义的类型通知 [英] Jelly Bean: The method setPriority(int) is undefined for the type Notification

查看:363
本文介绍了果冻豆:该方法setPriority(INT)是未定义的类型通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

,因为果冻豆有可能一个优先级设置为通知。这样,您甚至可以设置PRIORITY_MIN这山上隐藏状态栏上的通知图标。
我读到它,这是非常简单,你只需要使用这样的:

since Jelly Bean it is possible to set a priority to notifications. This way you can even set PRIORITY_MIN which hill hide the notification icon on status bar. I read about it and it is very simple, you just have to use this:

MyNotification.setPriority(Notification.PRIORITY_MIN);

我的问题上课,我得到的编译错误:
的方法setPriority(INT)是未定义的类型通知

我的应用程序在不同的Andr​​oid版本上运行,所以,据我所知,功能不软糖下可用,所以是有办法将包括类似的补充取决于Android的发布该功能的编译器标签什么的。
我希望你明白我的意思。
在此先感谢

My application has to run in different versions of Android, so, I understand that function is not available under JellyBean, so is there a way to include compiler tags or something similar to add that functionality depending on the Android release. I hope you understand what I mean. Thanks in advance

推荐答案

Android将会自动地处理这个问题。无需针对特定版本号的其他标记。当涉及到你的编译错误,我有运气的东西,如我下面code。你要确保使用 NotificationCompat ,并确保您导入 android.support.v4.app.NotificationCompat; 作为好。

Android will handle this automagically. No need for additional markup for specific version numbers. When it comes to your compile error, I've had luck with something like my code below. You want to make sure to use NotificationCompat and make sure you import android.support.v4.app.NotificationCompat; as well.

int pri = 0;
NotificationCompat.Builder MyNotification = new NotificationCompat.Builder(ctx);
MyNotification.setPriority(pri);

这篇关于果冻豆:该方法setPriority(INT)是未定义的类型通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆