Cordova plugin not working

Hello,

I am relative new to Meteor. I want to use this Cordova plugin:

I already installed it using the CLI. Now I use this code, but nothing happens in the emulators:

if(Meteor.isCordova) {

Meteor.startup(function () {

	function onFail(message) {
	    alert('Failed because: ' + message);
	}
	
	function onSuccess2(text) {
		alert(text);
	}

	// value should be float in range from 0 to 1.
	cordova.plugins.brightness.setBrightness(0.5, onSuccess2, onFail);
	
	alert("Setted!");
});
}

What am I doing wrong?

Thanks.

Try it on a device, this might be something which only works on a device.

edit: You do see the debugging “Setted!” right?

When I test it on a device using:

meteor run android-device

it also doesn’t work. I do see the “Setted” alert.

You might try building an APK and then do adb install [your apk] to your device. I’ve noticed differences in the past. Also, it sometimes pay to run rm -rf .meteor/local/cordova-build to clear out all the old code and start fresh. Think of it like clean.

Put a console log between every step to see all gets called. And then only way is to test on a real device.

Thanks, it turns out the plugin had errors. I have it working now.

@eelcol great to hear that!