通知不显示声音设置的灯光

时间:2016-02-05 23:47:59

标签: android notifications

当我添加.setDefaults(DEFAULT_SOUND)或DEFAULT_LIGHTS或DEFAULT_ALL时,它会显示抬头通知,但不会显示带有.setLights(0x0FF00FF0,300,100)的灯光设置。如果我删除.setDefaults它不会显示抬头,但会显示灯光。

Intent notificationIntent = new Intent(Intent.ACTION_VIEW);
    notificationIntent.setData(Uri.parse("http://www.wgn.com"));
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

Notification notification = new NotificationCompat.Builder(this)
        .setCategory(Notification.CATEGORY_MESSAGE)
        .setContentTitle("Yi Warning")
        .setContentText("Battery is below 20%")
        .setSmallIcon(R.drawable.ic_launcher)
        .setAutoCancel(true)
        .setVisibility(1)
        .setContentIntent(contentIntent)
        .setPriority(Notification.PRIORITY_MAX)
        .setDefaults(Notification.DEFAULT_SOUND)
        .setLights(0x0FF00FF00, 300, 100).build();
NotificationManager notificationManager =
        (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notification);

1 个答案:

答案 0 :(得分:0)

已移除

var namespaceResolver = new XmlNamespaceManager(new NameTable());
namespaceResolver.AddNamespace("math", "http://www.ludlowcloud.com/Math");
var grades = xDoc.XPathSelectElements("//math:Student/math:Grade", namespaceResolver);

并添加了

.setDefaults(Notification.DEFAULT_SOUND)

现在一切都很好:D

相关问题