gpt4 book ai didi

android - Cordova 的状态栏通知插件错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:17:44 24 4
gpt4 key购买 nike

我正在尝试将 Cordova 的状态栏通知插件添加到我的 Android 应用程序,但我收到了代码错误。

这是有问题的代码:

  Notification noti = new Notification.Builder(context)
.setContentTitle(contentTitle)
.setContentText(contentText)
.setSmallIcon(icon)
.build();

错误在 .build() 上,Eclipse 告诉我:

"The method build() is undefined for the type Notification.Builder"

最佳答案

我遇到了同样的问题。看起来 sdk 版本和现在贬值的方法不匹配。

getNotification() 是从 API 11 开始调用的方法API 16 中添加了 build()

如果您像我一样,使用的版本 < 16,那么请改用 .getNotification()。

我现在不打算担心 API 16,但我敢打赌,如果我下载 16 并将我的目标设置为这样,build() 将起作用。

让我知道它是否适合您。

关于android - Cordova 的状态栏通知插件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11581510/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com