Date: 2015-10-18
Last Update: 2016-02-09
Phonegap Desktop App, current version is 0.2.1 (as of 2015/12/22). It has the doubious distinction of having NO documentation. The little directions available come from the Phonegap Developer App and THE phonegap tutorial.
The largest issue is Step 5: Going Further. In this step, and afterwards, they do NOT inform people that using the framework work created with Phonegap CLI will NOT work with Phonegap Build.
Namely, there has been a rush to make website wrappers. This may be because of some poorly written article. Doing so may get the app rejected.
Quote Apple iTunes Guidelines - 2.12
Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected
You are not using the this
context correctly. This is a common mistake. The Javascript this
does NOT work like the Java this
.
The reason it does not work is because the this
gets resolved at run-time, not assemble-time (or compile-time). When the event fires, this
resolves to the the global this
because your app object is now out of scope. The event fires *outside* of your app
object.
A quick fix would be to do app.onDeviceReady
instead of You can test this by making your this.onDeviceReady
onDeviceReady()
a global function and leaving the this
in place.
OHH, and any setTimeout()
answer that anyone has given you does not know they need to wait for the deviceready
event. Bad code and bad advice abound in the Javascript world.
These videos should help. ? Best of Luck.
- Context in JavaScript - 1/4 - Purpose and Problems with JavaScript's "This"
- Context in JavaScript - 2/4 - How JavaScript Decides What "This" Actually Is
- Context in JavaScript - 3/4 - "This" May Not Be What You Expected & How to Fix It
- Context in JavaScript - 4/4 - Mastering "This:" Additional Techniques & Future Support
*Typical message from Google
Security alert
Your app is using a version of Apache Cordova containing one or more security vulnerabilities. Please see this Google Help Center article for details, including the deadline for fixing the app.
*Google's FAQ on this, as found by Petra V. on nitobi