Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

Implementing cordova-plugin-local-notifications for Vue

$
0
0

Hello Team,

I was posting this also on stackoverflow, here is the link: (https://stackoverflow.com/questions/70261263)

I’m using Vue3 with Ionic and want to set up a local notification. The ionic docs only describe how to do it for Angular (Local Notifications: iOS & Android | Cordova Local Notifications).

The implementation doesn’t necessarily need to be with Ionic, a Vue3 implementation would be fine.

First I Downloaded the modules:

npm install cordova-plugin-local-notification
npm install @ionic-native/local-notifications

Now i’m already stuck at importing the module, as for Angular it would be

import { LocalNotifications } from '@ionic-native/local-notifications/ngx';

But how would I do that with Vue?

The next question would be how to use it. Something like that?:

<script>
  import { LocalNotifications } from '@ionic-native/local-notifications/ ???';

  export default {
    components: { LocalNotifications },
    data() {
      return {
        localNotifications: LocalNotifications,
      };
    },
    methods: {
      note() {
        this.localNotifications.schedule({
          id: 1,
          text: 'Single LocalNotification',

          data: { secret: key },
        });
      },
    },
  };
</script>

Thanks in advance.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles