Cannot install Cordova Plugin PowerManagement to Monaca project



  • Hi,
    I want to install Cordova Plugin PowerManagement to my Monaca project by Monaca Localkit but this plugin is unavailable after installed.
    I tried install by Cordova command line:

    $ cordova plugin add https://github.com/Viras-/cordova-plugin-powermanagement.git
    

    but there is a error:

    Error: The provided path "/Users/dang.toan/Documents/TestIdleTimerDisable/platforms/ios" is not a Cordova iOS project.
    

    Addition, I also try edit file .monaca/project_info.json as below:

    "external_plugins": [
            "cordova-plugin-whitelist@1.0.0",
            "cordova-plugin-splashscreen@2.1.0",
            "cordova-plugin-device@1.0.1",
            "cordova-plugin-inappbrowser@1.4.0",
            "https:\/\/github.com\/whiteoctober\/cordova-plugin-app-version",
            "https:\/\/github.com\/Viras-\/cordova-plugin-powermanagement.git"
        ]
    

    It still not work.
    I’d really appreciate it if you can help me how to install this plugin to Monaca project.
    Thanks!


  • Monaca

    Have you tried to add the plugin in the root directory of your project? It seems that you are trying to add it into the ios platform dir.



  • Hi @Andi ,
    I added the plugin in the root directory project: /Users/dang.toan/Documents/TestIdleTimerDisable. But it return error as I said:

    Error: The provided path "/Users/dang.toan/Documents/TestIdleTimerDisable/platforms/ios" is not a Cordova iOS project.
    

    Addition, I created this project by LocalKit.


  • Monaca

    @TOAN-DANG I think I found the issue. Try to remove and add again the platform files, then install the plugin again:

    cordova platform rm ios 
    cordova platform add ios  
    
    cordova platform rm android
    cordova platform add android
    
    cordova plugin add https://github.com/Viras-/cordova-plugin-powermanagement.git 
    

    It worked for me :)



  • Hi @Andi ,
    Thanks for your support. I tried this way before but the new iso platform is Cordova platform, so I afraid it doesn’t work with Monaca build.
    Actually, I just tried with Monaca Debugger, the plugin didn’t work. I will try with Monaca Build.
    Thanks.


  • Monaca

    Dear Toan, that’s actually another issue not related to the import process. Anyway, at the moment, the best way to import plugins is directly from Monaca Web IDE, then work on the project locally with Localkit/CLI.


Log in to reply