Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't make it work #9

Open
CrowdedFuzzball opened this issue Jan 4, 2015 · 1 comment
Open

Can't make it work #9

CrowdedFuzzball opened this issue Jan 4, 2015 · 1 comment

Comments

@CrowdedFuzzball
Copy link

Hello!

Don't know why but i can't make it work for Android.

What i have already:

  1. install plugin "cordova plugin add https://github.com/fiscal-cliff/phonegap-plugin-brightness.git"
  2. make brightness.js file with this lines:
    document.addEventListener('deviceready', onDeviceReady);
    function onDeviceReady() {
    window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");
    }
    function setBrightness(value) {
    brightness.setBrightness(value, win, fail);
    }
    function getBrightness() {
    brightness.getBrightness( win, fail);
    }
    function win(status) {
    alert('Message: ' + status);
    }
    function fail(status) {
    alert('Error: ' + status);
    }
  3. call setBrightness(0.6);

All i have in ADB is "D/CordovaLog( 2007): file:///android_asset/www/js/brightness.js: Line 8 : Uncaught ReferenceError: brightness is not defined"
This error point to the "brightness.setBrightness(value, win, fail);" line.

I try to remake project, clean plugin dir and redownload it, and many other things...
Where is my mistake?

Thank you!

@fiscal-cliff
Copy link
Owner

sometimes phonegap projects fail to use plugins. it occures randomly for unknown reason. I have found the way to solve this problem. You should use plugman instead of built in phonegap plugin manager. I'm in doubt wheither it will solve the problem or not since I didn't use the plugin for about year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants