@developerswarehouse/notification-settings-opener
v0.1.0
Published
Notification Settings Opener
Downloads
1
Readme
@developerswarehouse/notification-settings-opener
An Ionic Capacitor plugin to open an apps native notificaiton settings.
Currently only supports Android.
Resourced and built with our trusty friend ChatGPT.
TODO
- Add support for iOS
Install
npm install @developerswarehouse/notification-settings-opener
ionic cap sync android
Add to a component
Ionic+VueJS
<script setup>
import { NotificationSettingsOpener } from '@developerswarehouse/notification-settings-opener';
// Open native notification settings
const openAppNotificationSettings = () => {
NotificationSettingsOpener.openNotificationSettings().then(() => {
console.log('Notification settings opened');
});
}
// Or...
// const openAppNotificationSettings = async () => {
// await NotificationSettingsOpener.openNotificationSettings();
// }
</script>
<template>
<ion-page>
<ion-content>
<h1>Push Notifications</h1>
<ion-note class="ion-margin-top">
<p>You can manage your notifications under app settings.</p>
</ion-note>
<ion-button @click="openAppNotificationSettings" class="ion-margin-vertical">Open App Notification Settings</ion-button>
</ion-content>
</ion-page>
</template>
API
openNotificationSettings()
openNotificationSettings() => Promise<void>
This method opens the device's native notification settings for the app.