有什么区别:notification.flags和notification.defaults?

Saa*_*iko 4 notifications flags android default

在我的测试代码中,我使用过

        notification.flags |= Notification.DEFAULT_SOUND;
    notification.flags |= Notification.DEFAULT_LIGHTS;
Run Code Online (Sandbox Code Playgroud)

这没有用,根据我得到的另一个问题的答案,我改变了.flags到.defaults并且它有效.

        notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_LIGHTS;
Run Code Online (Sandbox Code Playgroud)

文档中,两个字段:标志和默认值是相同的.

我什么时候使用哪个?我可以设置同一家族的2个标志吗?

rob*_*ton 5

系统必须检查这些字段以查找不同的内容.它检查"默认值"以查看您希望哪些功能成为其默认值,并在"flags"中查找其他一些标志.这一切都在开发指南中进行了解释