
我在我的应用程序上实现了解析推送通知的android通知.但最近我意识到kitkat上没有显示通知内容.它只在OS Lollipop上显示.
这是图像……
在Kitkat 4.4.4上:
在棒棒糖5.0:
两个图像的代码相同:
NotificationCompat.InBoxStyle inBoxStyle = new NotificationCompat.InBoxStyle();NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext);Notification notification = mBuilder.setSmallicon(smallicon).setTicker(Title) //Title .setWhen(System.currentTimeMillis()) .setautoCancel(true) .setContentTitle(Title) .setStyle(inBoxStyle) .setContentIntent(resultPendingIntent) .setSound(ringtoneManager.getDefaultUri(ringtoneManager.TYPE_NOTIFICATION)) .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon)) .setContentText(notifMessage) .build();notificationmanager notificationmanager = (notificationmanager) mContext .getSystemService(Context.NOTIFICATION_SERVICE);notificationmanager.notify(mNotificationID, notification);对于信息,我使用构建工具23.0.2(编写此问题时最新).这是我的app build.gradle:
apply plugin: 'com.androID.application'androID { compileSdkVersion 23 buildToolsversion "23.0.2"...有什么区别?
任何帮助将不胜感激.提前致谢
解决方法:
解决了.仅替换此部分:
.setWhen(System.currentTimeMillis())这一个:
.setWhen(0)我不知道&不在乎为什么会这样.我认为这是一个错误
总结以上是内存溢出为你收集整理的Android通知内容文本不会出现在OS 4.4.4 Kitkat上,但显示在OS 5.0 Lollipop上全部内容,希望文章能够帮你解决Android通知内容文本不会出现在OS 4.4.4 Kitkat上,但显示在OS 5.0 Lollipop上所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)