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 for build.phonegap.com #12

Closed
ghost opened this issue Jul 7, 2015 · 26 comments
Closed

can't make it work for build.phonegap.com #12

ghost opened this issue Jul 7, 2015 · 26 comments

Comments

@ghost
Copy link

ghost commented Jul 7, 2015

Is there any way to use this plugin for PhoneGap Build?

@fiscal-cliff
Copy link
Owner

Hello, I do not know, actually. But I would try to help you this weekend

@ghost
Copy link
Author

ghost commented Jul 8, 2015

Thank you!

On Jul 8, 2015, at 3:29 PM, Evgeniy L [email protected] wrote:

Hello, I do not know, actually. But I would try to help you this weekend


Reply to this email directly or view it on GitHub.

@fiscal-cliff
Copy link
Owner

Hi, I tried to submit the plugin on phongap build platform. But I need to buy something from adobe. I felt little bit disturbing about that. I try to clarify how much will it cost. Sorry for bad news.(

@ghost
Copy link
Author

ghost commented Jul 13, 2015

If it’s okay, I’ll fork it and try myself.

On Jul 12, 2015, at 1:34 PM, Evgeniy L [email protected] wrote:

Hi, I tried to submit the plugin on phongap build platform. But I need to buy something from adobe. I felt little bit disturbing about that. I try to clarify how much will it cost. Sorry for bad news.(


Reply to this email directly or view it on GitHub #12 (comment).

@fiscal-cliff
Copy link
Owner

Let me know, where it ended up.

@ghost
Copy link
Author

ghost commented Jul 14, 2015

Forked it, changed the id, submitted as a private plug-in, it worked with no further modification.

On Jul 14, 2015, at 4:22 PM, Evgeniy L [email protected] wrote:

Let me know, where it ended up.


Reply to this email directly or view it on GitHub #12 (comment).

@fiscal-cliff
Copy link
Owner

looks good.

@zekeriyademir
Copy link

Hi,
Im using phonegap build but I could not make the plugin work. However, when i try it on a non-PhonegapBuild project it works. Any suggestions?

@fiscal-cliff
Copy link
Owner

Hi! I'd prefer you solve this issue as justinc22 did. I can't register the plugin in the phonegap build myself, since I hadn't bought anything from them. If you hadn't bought anything too, I would try to find the way to register the plugin using an account of friend of mine. please tell me, could you register the plugin as private?

@zekeriyademir
Copy link

I did not buy anything so I cant register.
I would be more than appreciated if you could manage this using your friends account.

@fiscal-cliff
Copy link
Owner

I've found my plugin already published) Here the link:https://build.phonegap.com/plugins/3757

@zekeriyademir
Copy link

Yes it exist in phonegap build. But I couldnot make it work.
In readme it suggests to use:
window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");

I changed ID to "window.brightness = cordova.require("cordova.plugin.c22.Brightness.Brightness");

Again, it did not work.

@fiscal-cliff
Copy link
Owner

Hello!
Finally, I've published the plugin at phonegap build.

@zekeriyademir
Copy link

Hello, Thanks for your help.
Butt :( I still cant make it work. I get error on the line I mentioned below.
I asked to people on the phonegap build community, but even they could not find a solution.
Did you ever tried this on phonegap build?

//*_Error line- Error Message: Undefined_*
//window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");

//_My whole code:_
var app = {
// Application Constructor
initialize : function () {
this.bindEvents();
},
bindEvents : function () {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady : function () {
app.receivedEvent('deviceready');
},
receivedEvent : function (id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');

    console.log('Received Event: ' + id);

window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");
setBrightness(1);
}

};

function setBrightness(value) {
// value should be float in range from 0 to 1.
brightness.setBrightness(value, win, fail);
}
function getBrightness() {
// win([-1,0-1]) float 0-1 is a brightness level, -1 represents a system default
brightness.getBrightness(win, fail);
}
function win(status) {
alert('Message: ' + status);
}
function fail(status) {
alert('Error: ' + status);
}

@ghost
Copy link
Author

ghost commented Aug 7, 2015

Is there any way you can get a console on the app, so you can ask it yourself? I don’t use cordova.require, but I look at

if (cordova && cordova.plugins && cordova.plugins.brightness) cordova.plugins.brightness.setBrightness(x)

On Aug 7, 2015, at 7:41 AM, zekeriyademir [email protected] wrote:

Hello, Thanks for your help.
Butt :( I still cant make it work. I get error on the line I mentioned below.
I asked to people on the phonegap build community, but even they could not find a solution.
Did you ever tried this on phonegap build?

//Error line- Error Message: Undefined
//window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");

//My whole code:
var app = {
// Application Constructor
initialize : function () {
this.bindEvents();
},
bindEvents : function () {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady : function () {
app.receivedEvent('deviceready');
},
receivedEvent : function (id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');

listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');

console.log('Received Event: ' + id);

window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");
setBrightness(1);
}
};

function setBrightness(value) {
// value should be float in range from 0 to 1.
brightness.setBrightness(value, win, fail);
}
function getBrightness() {
// win([-1,0-1]) float 0-1 is a brightness level, -1 represents a system default
brightness.getBrightness(win, fail);
}
function win(status) {
alert('Message: ' + status);
}
function fail(status) {
alert('Error: ' + status);
}


Reply to this email directly or view it on GitHub #12 (comment).

@zekeriyademir
Copy link

if (cordova && cordova.plugins && cordova.plugins.brightness) // returns true
{
cordova.plugins.brightness.setBrightness("1"); //does nothing
}

stataments below returns true but cordova.plugins.brightness.setBrightness(1); doesn't change anything on the screen brightness.

@fiscal-cliff
Copy link
Owner

Hello! I would recomend you to build the sample application. I didn't compile any application in phonegap build. But @JustinC22 did. Actually, setBrightness('1') means, that you are trying to set 100% brightness. And if you have 100% brightness, you won't see any changes. Please tell me what version of OS/device you tested, and attach console.log to the issue.

@zekeriyademir
Copy link

I am able to use your plugin successfully in phonegap. But I it does not work with Phonegap Build with the same device and settings. I am using Android 4.1.1, Phonegap build version 3.7.0.

I used your sample application and added "<gap:plugin name="cordova.plugin.brightness" />" to your xml file to be able to use plugin for phonegap build. 3 buttons on the page (1, 0.1 and get) didn't do anything.

The line below throws an error "undefined":
window.brightness = cordova.require("cordova.plugin.Brightness.Brightness");

Thank you very much for trying to help me...

@fiscal-cliff
Copy link
Owner

I tried to compile test application myself this evening. And it seems that I failed to add my plugin into this application)) I will let you know if things become clear.

@fiscal-cliff
Copy link
Owner

Hi!
I tried to sort out all the things. And here is a short list of discovered problems:

  1. I have failed to add any plugins to my test application at all. I always get "This application has no plugins.". And It seems that phonegap allows you to add plugins to your application when you using upgraded account. Sounds weird, but it is very likely. @JustinC22 may take a screenshot of his "plugins" tab, where I couldn't manage to have any plugins.
  2. Phonegap actually upped a major version. Now they added support for 5.1.1 CLI. And this version supports modern npm-related plugin repository. But they have broken backward compatibility with older plugins.
  3. My experience with phonegap was pretty disturbing, since they always ignored backward compatibility issues. This case cannot be excluded from the list. So If you can help me to adapt the plugin to new CLI, We will get it work in CLI 5.1.1 quickly.
    Thank you for patience.

@zekeriyademir
Copy link

Hi,
It is possible to use plugins without an upgraded account in Phonegap Build. You may have not correctly changed your config file if you dont see any plugins.
I used your sample project and changed config file accordingly. Here is the zip file for it. You can directly upload it to phonegap build and see that your plugin is added to the project.
Zip file: https://www.dropbox.com/s/3sv1d2byxe6l5av/Brightness%20PGB.zip?dl=0
Screenshot of plugin list:https://www.dropbox.com/s/ltwuq7t4oq110b7/screenshot.png?dl=0

Hope this helps...

@fiscal-cliff
Copy link
Owner

Hello, @zekeriyademir! So, I guess, your version works just perfect)))
Brightness changes as expected.
screenshot

@zekeriyademir
Copy link

It is not working on my mobile phone. Did you try it on a real device?
If so, it should be related to my phone...
Thank you..

@fiscal-cliff
Copy link
Owner

Yes, It was a real phone. Nexus 5, Android 5.1. I've just tried android 4.1.2 on sgs3, and it works, I have developed the plugin on that device. Here is shared pgb application.

@zekeriyademir
Copy link

Thank you very very much for your help!!
I deleted my app and then reinstalled it rather then just updating the existing app. And it started to work like a charm!
Finally!!

@fiscal-cliff
Copy link
Owner

so, done with this issue)

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