Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Helpers/NotificationHelper.java
1 | package org.kde.kdeconnect.Helpers; | 1 | package org.kde.kdeconnect.Helpers; | ||
---|---|---|---|---|---|
2 | 2 | | |||
3 | import android.app.Notification; | 3 | import android.app.Notification; | ||
4 | import android.app.NotificationManager; | 4 | import android.app.NotificationManager; | ||
5 | 5 | | |||
6 | public class NotificationHelper { | 6 | public class NotificationHelper { | ||
7 | 7 | | |||
8 | public static void notifyCompat(NotificationManager notificationManager, int notificationId, Notification notification) { | 8 | public static void notifyCompat(NotificationManager notificationManager, int notificationId, Notification notification) { | ||
9 | try { | 9 | try { | ||
10 | notificationManager.notify(notificationId, notification); | 10 | notificationManager.notify(notificationId, notification); | ||
11 | } catch(Exception e) { | 11 | } catch (Exception e) { | ||
12 | //4.1 will throw an exception about not having the VIBRATE permission, ignore it. | 12 | //4.1 will throw an exception about not having the VIBRATE permission, ignore it. | ||
13 | //https://android.googlesource.com/platform/frameworks/base/+/android-4.2.1_r1.2%5E%5E!/ | 13 | //https://android.googlesource.com/platform/frameworks/base/+/android-4.2.1_r1.2%5E%5E!/ | ||
14 | } | 14 | } | ||
15 | } | 15 | } | ||
16 | 16 | | |||
17 | public static void notifyCompat(NotificationManager notificationManager, String tag, int notificationId, Notification notification) { | 17 | public static void notifyCompat(NotificationManager notificationManager, String tag, int notificationId, Notification notification) { | ||
18 | try { | 18 | try { | ||
19 | notificationManager.notify(tag, notificationId, notification); | 19 | notificationManager.notify(tag, notificationId, notification); | ||
20 | } catch(Exception e) { | 20 | } catch (Exception e) { | ||
21 | //4.1 will throw an exception about not having the VIBRATE permission, ignore it. | 21 | //4.1 will throw an exception about not having the VIBRATE permission, ignore it. | ||
22 | //https://android.googlesource.com/platform/frameworks/base/+/android-4.2.1_r1.2%5E%5E!/ | 22 | //https://android.googlesource.com/platform/frameworks/base/+/android-4.2.1_r1.2%5E%5E!/ | ||
23 | } | 23 | } | ||
24 | } | 24 | } | ||
25 | } | 25 | } |