标题是重复的,但我的问题是不同的.
同样的项目工作正常,并允许建立
buildToolsVersion 23.0.3
在我的同事的系统上.据我所知,只有android studio版本不同.如果我没有将我的android工作室升级到"2.3.Beta 2",我仍然可以用23.0.3构建吗?
我不确定这是否完全可能,但我会说明我的要求。如果可能的话请帮我弄清楚该怎么做。
假设我有一个类似画廊的 Android 应用程序。当用户对图库中的照片进行点赞或评论时,我们将使用下面给出的代码触发 fcm 通知
value++;
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification)
.setLargeIcon(rawBitmap)
.setContentTitle("MyApp")
.setContentText(ContentText)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setDefaults(Notification.DEFAULT_SOUND)
.setStyle(new NotificationCompat.BigTextStyle().bigText(ContentText))
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(value, notificationBuilder.build());
Run Code Online (Sandbox Code Playgroud)
通过添加 InboxStyle,我们可以将通知分组为一个通知,然后增加计数。(例如,您有 5 个通知)
NotificationCompat.InboxStyle inboxStyle =
new NotificationCompat.InboxStyle();
// Sets a title for the Inbox in expanded layout
inboxStyle.setBigContentTitle("Title - Notification");
inboxStyle.setSummaryText("You have "+value+" Notifications.");
notificationBuilder.setStyle(inboxStyle);
Run Code Online (Sandbox Code Playgroud)
但我的要求就像对单独的照片进行单独分组。如果用户为 3 张照片各留下 2 条评论。我需要列出三组通知。更像是您对这张照片有 2 条评论,对这张照片有 2 条评论,等等。
如果有帮助的话,我将收到照片的唯一 ID。
How long will the id be retained?
Run Code Online (Sandbox Code Playgroud)
假设用户对 ID 为 001 的照片发表了 2 …
android push-notification android-notifications firebase firebase-cloud-messaging