瀏覽代碼

feat(android) expose channels ids

master
tmoldovan8x8 4 年之前
父節點
當前提交
c7ad5b5b26
沒有連結到貢獻者的電子郵件帳戶。

+ 11
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/NotificationChannels.java 查看文件

1
+package org.jitsi.meet.sdk;
2
+
3
+import java.util.ArrayList;
4
+import java.util.List;
5
+
6
+public class NotificationChannels {
7
+    static final String ONGOING_CONFERENCE_CHANNEL_ID = "JitsiOngoingConferenceChannel";
8
+    static final String ONGOING_CONFERNCE_CHANNEL_NAME = "Ongoing Conference Notifications";
9
+
10
+    public static List<String> allIds = new ArrayList<String>() {{ add(ONGOING_CONFERENCE_CHANNEL_ID); }};
11
+}

+ 6
- 6
android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java 查看文件

16
 
16
 
17
 package org.jitsi.meet.sdk;
17
 package org.jitsi.meet.sdk;
18
 
18
 
19
+import static org.jitsi.meet.sdk.NotificationChannels.ONGOING_CONFERENCE_CHANNEL_ID;
20
+import static org.jitsi.meet.sdk.NotificationChannels.ONGOING_CONFERNCE_CHANNEL_NAME;
21
+
19
 import android.app.Notification;
22
 import android.app.Notification;
20
 import android.app.NotificationChannel;
23
 import android.app.NotificationChannel;
21
 import android.app.NotificationManager;
24
 import android.app.NotificationManager;
39
 class OngoingNotification {
42
 class OngoingNotification {
40
     private static final String TAG = OngoingNotification.class.getSimpleName();
43
     private static final String TAG = OngoingNotification.class.getSimpleName();
41
 
44
 
42
-    private static final String CHANNEL_ID = "JitsiNotificationChannel";
43
-    private static final String CHANNEL_NAME = "Ongoing Conference Notifications";
44
-
45
     static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;
45
     static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;
46
     private static long startingTime = 0;
46
     private static long startingTime = 0;
47
 
47
 
60
             = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
60
             = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
61
 
61
 
62
         NotificationChannel channel
62
         NotificationChannel channel
63
-            = notificationManager.getNotificationChannel(CHANNEL_ID);
63
+            = notificationManager.getNotificationChannel(ONGOING_CONFERENCE_CHANNEL_ID);
64
         if (channel != null) {
64
         if (channel != null) {
65
             // The channel was already created, no need to do it again.
65
             // The channel was already created, no need to do it again.
66
             return;
66
             return;
67
         }
67
         }
68
 
68
 
69
-        channel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
69
+        channel = new NotificationChannel(ONGOING_CONFERENCE_CHANNEL_ID, ONGOING_CONFERNCE_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
70
         channel.enableLights(false);
70
         channel.enableLights(false);
71
         channel.enableVibration(false);
71
         channel.enableVibration(false);
72
         channel.setShowBadge(false);
72
         channel.setShowBadge(false);
84
         Intent notificationIntent = new Intent(context, context.getClass());
84
         Intent notificationIntent = new Intent(context, context.getClass());
85
         PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
85
         PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
86
 
86
 
87
-        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID);
87
+        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, ONGOING_CONFERENCE_CHANNEL_ID);
88
 
88
 
89
         if (startingTime == 0) {
89
         if (startingTime == 0) {
90
             startingTime = System.currentTimeMillis();
90
             startingTime = System.currentTimeMillis();

Loading…
取消
儲存