gpt4 book ai didi

android - CWAC 更新程序问题与通知

转载 作者:行者123 更新时间:2023-11-30 02:57:15 25 4
gpt4 key购买 nike

我正在使用这个库 https://github.com/commonsguy/cwac-updater为应用程序提供自动更新功能。

我阅读了 demoUpdater,它为 Notification 使用了已弃用的 API,因此我使用了以下代码:

ConfirmationStrategy buildPreDownloadConfirmationStrategy(Context mContext) {

long[] vibrate = { 0, 100, 200, 300 };
NotificationManager mNotificationManager= (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);

NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(mContext)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Update Available")
.setContentText("Click to download the update!")
.setVibrate(vibrate)
.setAutoCancel(true)
.setLights(Color.BLUE, 500, 500);
mNotificationManager.notify(1, mBuilder.build());
return null;

//return(new NotificationConfirmationStrategy());
}

但无法让它工作。

最佳答案

我成功了,如果有人发现问题,请使用下面的代码

ConfirmationStrategy buildPreDownloadConfirmationStrategy(Context mContext) {

long[] vibrate = { 0, 100, 200, 300 };
NotificationManager mNotificationManager= (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);

NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(mContext)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Update Available")
.setContentText("Click to download the update!")
.setVibrate(vibrate)
.setAutoCancel(true)
.setLights(Color.BLUE, 500, 500);
Notification notification = mBuilder.build();
mNotificationManager.notify(1, notification);

return(new NotificationConfirmationStrategy(notification));
}

关于android - CWAC 更新程序问题与通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23076015/

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