Skip to content

Commit e18d25e

Browse files
Merge pull request #175 from ezlo-ionutrusu/fix/android-has-permission
fix/android-has-permission
2 parents d335b5c + ac7bd3d commit e18d25e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/local-notifications.android.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ export class LocalNotificationsImpl extends LocalNotificationsCommon implements
7878
hasPermission(): Promise<boolean> {
7979
return new Promise((resolve, reject) => {
8080
try {
81-
// nothing to do on this platform
82-
resolve(true);
81+
const context = utils.ad.getApplicationContext();
82+
const hasPermission = NotificationManagerCompatPackageName.NotificationManagerCompat.from(context).areNotificationsEnabled();
83+
resolve(hasPermission);
8384
} catch (ex) {
8485
console.log("Error in LocalNotifications.hasPermission: " + ex);
8586
reject(ex);
@@ -244,4 +245,4 @@ export class LocalNotificationsImpl extends LocalNotificationsCommon implements
244245
}
245246
}
246247

247-
export const LocalNotifications = new LocalNotificationsImpl();
248+
export const LocalNotifications = new LocalNotificationsImpl();

0 commit comments

Comments
 (0)