I have researched this and it seems from everything I have read it something on your end, I am referencing cordova.js not phonegap.js and I am still experiencing this issue.
- 27 Posts
- 0 Reply Likes
Posted 4 years ago
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
The docs example says 'frequency', but the docs text says 'period'.
Try 'period'.
- 27 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
- 27 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
And do you get different values if you reboot and restart the app?
And are these values any different from your initial getCurrentAcceleration()?
- 27 Posts
- 0 Reply Likes
- 27 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Be also aware that the plugin docs mention Milliseconds, while the Android Sensor docs mention Microseconds. My guess is that the plugin docs are wrong here, too.
You should be able to verify this, though, using the timestamp coming with the success callback parameters.
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
Since this is your first post, please answer the following question.
- Is this your first hybrid App?
- Are you using the Phonegap Desktop App?
- Are you using CLI, SDK or Build? Please do not assume the answer, please read the link.
Jesse
- 27 Posts
- 0 Reply Likes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
are you using CLI at all?
You mention Ripple emulator. So your comments are inconsistent.
Can you explain?
Jesse
- 27 Posts
- 0 Reply Likes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
Did your proffeser say this would work with build.phonegap.com?
Please be aware that if he used Phonegap CLI to create this "premade build", it will not work with build.phonegap.com without special changes.
AND if you proffeser does not know this, he needs to make very clear that build.phonegap.com will NOT work with Phonegap CLI - AS IS. In addition, using CLI with Build is an advance subject and he should reconsider his lessons (if he is doing this).
Lastly, using CLI created files with Build is a very common mistake.
This FAQ should help. Read the bold sentences first.
Top Mistakes by Developers new to Cordova/Phonegap
Let me know what you want to do.
Jesse
- 27 Posts
- 0 Reply Likes
This directory contains the working app that will work in the Ripple simulator.
It contains the phonegap.js JavaScript file. This file is really the cordoba.js file that has been re-named to phonegap.js. It's version 2.0 and that's the version that still works well with Ripple emulator. However, Adobe PhoneGap build will substitute the version of phonegap.js specified in the config.xml during the build process.
www directory:
This directory is a copy of the working app that is sent to build.phonegap.com . There are two important differences in this directory:
it is missing the phonegap.js JavaScript file (but not the reference to it in index.html)
It contains a config.xml file that describes the PhoneGap project.
apk file:
This is the file that can be loaded to an android phone and installed as an app.
This file can be generated by build.phonegap.com
www.zip:
This is the zipped contents of the www directory and is the file you upload to build.phonegap.com
Ripple Emulator
Use this Chrome extension to develop and test your app: (Chrome web store)
Important: You will need to load your app from a Web Server and not a local file for it to work.
Install this extension into Chrome. Ripple Emulator is a chrome extension and can be found by googling Ripple Emulator (Beta) for Chrome or following the above link.
This is a description of the files we were given.
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
while I read the entire thread again, I will note the description is a bit convoluted (but essentially correct). Is there any part that seems odd to you?
Jesse
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
can you put the code up so Petra & I can look at the current version?
Jesse
- 27 Posts
- 0 Reply Likes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
I looked at your code. I could complain about style, but my real concern is
if (previousAcceleration.x == null && previousAcceleration.y == null && previousAcceleration.z == null) {
The assignment to the variable set (previousAcceleration) is buried. How do you know it even gets there? It's also an awkward way of doing things.
Jesse
- 27 Posts
- 0 Reply Likes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
I don't know what you are trying to do, so I can't help. I suggest you write out the logic in English, then work from there. Using Internal values as flags is valid, but generally you want to remove the value from the logical flow.
For instance, I might write.
flagX = previousAcceleration.x
flagY = previousAcceleration.y
flagZ = previousAcceleration.z
if (flagX == null && flagY == null && flagZ == null)
The advantage of this is that you can override the logic and see if the values are the problem.
REMEMBER: Javascript has a notion called "truthy" and "falsey". This means a value can be evaluated to true or false. Javascript does NOT have a strict boolean like other languages. The best you can do is:
if (flagX === null && flagY === null && flagZ === null)
This means the value is null and *must* be null.
The previous was the value is like null.
Jesse
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers


