cordova plugins not working



  • hey guys, been trying to use cordova plugins and i’ve reached the point where i’m tearing out my hair.
    tried to use these two plugins namely phonegap-plugin-push and cordova-plugin-facebook4
    both install successfully but the issue is it does nothing which is frustrating because when i log their api’s its not undefined , tried running it separately outside the export with the device ready event. the event gets triggered ok but none of the plugins apis work
    in a new cordova project this runs alright .

    facebookConnectPlugin.login([‘public_profile’, ‘pages_messaging’, ‘manage_pages’], function (data) {
    alert(data)
    }, function (err) {
    alert(err)
    });

    const push = PushNotification.init({
    android: {
    alert: “true”,
    badge: “true”,
    sound: “true”,
    forceShow:“true”
    },
    browser: {
    pushServiceURL: ‘http://push.api.phonegap.com/v1/push
    },
    ios: {
    alert: “true”,
    badge: “true”,
    sound: “true”
    },
    windows: {}
    });

      push.on('registration', function (data) {
        // data.registrationId
        alert('reg',data)
      });
    
      push.on('notification', function (data) {
        alert('not',data)
        // data.message,
        // data.title,
        // data.count,
        // data.sound,
        // data.image,
        // data.additionalData
      });
    

    but in quasar whether in mounted,created or outside the export nothing happens . don’t know what i’m doing wrong would even love to get an error at this point .please help



  • Hi, did you try with other plugins like the ones in the quasar guide : https://quasar-framework.org/guide/cordova-plugins.html ?

    Are they aded to your config.xml in your codova folder ?



  • Hey, do you find a way to resolve this issue ?
    I encounter the same issue with phonegap-plugin-push…
    Thanks



  • After two days, I resolve this issue. @Florentin you’re right.
    You’ve to add plugin to config.xml:
    <plugin name="phonegap-plugin-push" spec="^2.2.3" />


Log in to reply