Search code examples
cordovanotificationsphonegap-pluginscordova-pluginsphonegap

cordova local notification plugin not working


Day 5.

Go through the list I have written below, it works for me.

Setup specs:

  • Phonegap version: 7.1.1
  • Browser: chrome
  • Phone: 1 plus x
  • Phone android version: 6.0.1
  • Cordova version 8.0.0
  1. First test that everything is installed by cmd
    • java -v --> version 1.8.0_152
    • javac -version --> version 1.8.0_152
    • node -v --> v8.9.4
    • cordova -v --> 8.0.0
    • phonegap -v --> 7.1.1
    • sdkmanager --> sdkmanager installed
    • sdkmanager --list --> installed packages:
      • build-tools;25.0.2
      • build-tools;26.0.2
      • Emulator
      • extras;android;m2repository
      • extras;google;m2repository
      • extras;intel;Ha...ecution_Manager
      • patcher;v4
      • platform-tools
      • platforms;android-25
      • platforms;android-26
      • tools
  2. Create a new project
    • cordova create notificationApp com.notification.example notificationApp
    • cordova platform add browser
    • cordova platform add ios
    • cordova platform add android
  3. check platforms installed
    • cordova platform list --> all in installed platforms
  4. Check requirements
  5. cordova requirements
    • Java JDK installed
    • Android SDK installed
    • Android target installed
    • Gradle installed
    • Browser installed
  6. Test installation
    1. cordova run --> build succesfull
    2. cordova build --> build succesfull
  7. Add and check the plugin
    • cordova plugin add cordova-plugin-local-notification
    • cordova plugin list
      • cordova-plugin-badge 0.8.6 "Badge"
      • cordova-plugin-device 2.0.1 "Device"
      • cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
      • cordova-plugin-whitelist 1.3.3 "Whitelist"
  8. Add javascript for testing in js/index.js in onDeviceReady
cordova.plugins.notification.local.schedule({
    id:1,
    title: 'My first notification',
    text: 'finally works!'
});

I get the

"Error: exec proxy not found for :: LocalNotification :: request" 

error. Which I have read should be ok when in browser.

I tested this on my phone and now it works! If something goes wrong in the installation of the local notification project, I would have to delete the project and start over. I don't know why this is? And why the phonegap uploads has the error:

Error - Some official plugins have to be updated if using PhoneGap >= 4.0.0. 
Please upgrade the version of any plugins that may include the following 
file: Manager.java - You can fix this here

But if I just download the app to my phone there is no problems, so I will live with that.


Solution

  • If I follow the list created in my post, it works but not with phonegap of some reason.

    Make sure everything is installed before starting to make the app.
    Setup java correctly, setup SDK ,install node.js, install cordova, test everything, install plugin, build, test

    Install cordova, java and android tools
    Plugin link - local notification