gpt4 book ai didi

java - 由于隐式 PendingIntent 漏洞的补救措施,Google 拒绝更新

转载 作者:行者123 更新时间:2023-12-04 11:05:56 26 4
gpt4 key购买 nike

当我尝试更新我的应用程序时 - 在审核过程中出现错误。隐式 PendingIntent 漏洞修复 - https://support.google.com/faqs/answer/10437428 .在我的应用程序中,我正在创建 PendingIntent - 用于 Firebase 推送通知:
FCMService 类内部扩展了 FirebaseMessagingService

@Override
public void onMessageReceived(@NotNull RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);

Intent intent = new Intent(this, ApplicationActivity.class);
intent.setAction("com.google.firebase.MESSAGING_EVENT");
intent.setPackage(getApplicationContext().getPackageName());

Map<String, String> data = remoteMessage.getData();
for (Map.Entry<String, String> entry : data.entrySet()) {
String value = entry.getValue();
String key = entry.getKey();
if (key.equals(ApplicationActivity.LINK_URL) ||
key.equals(ApplicationActivity.FLOCKTORY_LINK_URL)) {
intent.putExtra(ApplicationActivity.FLOCKTORY_LINK_URL, value);
if (remoteMessage.getNotification() != null && remoteMessage.getNotification().getTitle() != null) {
intent.putExtra(ApplicationActivity.HMS_PUSH_TITLE, remoteMessage.getNotification().getTitle());
}
}
}

PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);

RemoteMessage.Notification notification = remoteMessage.getNotification();
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, getString(R.string.channel_id))
.setSmallIcon(R.drawable.ic_launcher_notification)
.setColor(getResources().getColor(R.color.colorNotification))
.setContentTitle(notification == null ? "" : notification.getTitle())
.setContentText(notification == null ? "" : notification.getBody())
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent)
.setAutoCancel(true);

NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(new Random(UUID.randomUUID().getLeastSignificantBits()).nextInt(), builder.build());
在 list 中:
<service
android:name="ru.svyaznoy.shop.domain.FCMService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
实现“com.google.firebase:firebase-messaging:22.0.0”
minSdkVersion 24
targetSdkVersion 30
我只是无法弄清楚这段代码有什么问题 - 我通过设置了所有必填字段的显式 Intent 。我头晕目眩——这次更新非常重要。有没有人有类似的问题?

最佳答案

感谢@kkazakov 问题解决了。库 com.huawei.hms:push 包含隐式 PendingIntents 的不安全使用。谷歌批准了没有这个库的构建更新。
对我来说,是时候创建 gms 和 hms 构建风格,以避免将来与华为出现问题。

关于java - 由于隐式 PendingIntent 漏洞的补救措施,Google 拒绝更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68088627/

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