facebook

I Haz Cheeseburger?!?!?!

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #341767 Reply

    SKnoxmn
    Member

    Still trying to get an angle and bearing to display in a text field. I’m now positive that I’m missing something probably very simple here.

    Have a look and please advise; http://goo.gl/s81dZU

    function clearFields()
    {
    $(‘#m1-Learning-textField1’).val(”);
    $(‘#m1-Learning-textField2’).val(”);
    $(‘#m1-Learning-textField3’).val(”);
    $(‘#m1-Learning-textField4’).val(”);
    $(‘#m1-Learning-textField5’).val(”);
    }// clearFields

    function findPosition()
    {
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
    }// findPosition

    function findHeading()
    {
    navigator.compass.getCurrentHeading(compassSuccess, compassError);
    }// findHeading

    function onSuccess(heading)
    {
    $(‘#m1-Learning-textField5’).val(heading); I suspect its with this “heading”
    }// onSuccess

    function onSuccess(position)
    {
    $(‘#m1-Learning-textField1’).val(position.coords.latitude);
    $(‘#m1-Learning-textField2’).val(position.coords.longitude);
    $(‘#m1-Learning-textField3’).val(position.coords.altitude);
    }// onSuccess

    function onError(error)
    {
    $(‘#m1-Learning-textField1’).val(error.code);
    $(‘#m1-Learning-textField2’).val(error.message);
    }// onError

    Button: OnClick = return getCurrentHeading();

    Am I close?

    SKnox

    #341771 Reply

    SKnoxmn
    Member

    This doesn’t do it…

    function Orientation()
    {
    window.addEventListener(“deviceorientation”, handleOrientation, true);
    }// Orientation

    function handleOrientation(event)
    {
    var absolute = event.absolute;
    var alpha = event.alpha;
    var beta = event.beta;
    var gamma = event.gamma;
    } // Do stuff with the new orientation data

    function alpha()
    $(‘#m1-Learning-textField4’).val(event.beta);
    $(‘#m1-Learning-textField5’).val(event.alpha);

    #341772 Reply

    SKnoxmn
    Member

    This one didn’t either:

    window.addEventListener(“deviceorientation”, handleOrientation, true);

    function handleOrientation(event)
    {
    var absolute = event.absolute;
    var alpha = event.alpha;
    var beta = event.beta;
    var gamma = event.gamma;
    } // Do stuff with the new orientation data

    function event()
    $(‘#m1-Learning-textField4’).val(event.beta);
    $(‘#m1-Learning-textField5’).val(event.alpha);

    So far, all of these attempts to get the angle and direction have managed to “Disable” the other funtion that worked when getting Lat. Lon. and Alt.

    Open to suggestions,
    SKnox

    #341774 Reply

    @SKnoxmn,

    The “I Haz Cheeseburger?!?!?!” message is a goofy bug in the simulator that we are working on.

    Now, I’ve taken a look at your _custom.js code. And found out that there is a syntax error (you miss the braces in your alpha function) that can be the issue in your app:

    Attachments:
    You must be logged in to view attached files.
    #341776 Reply

    SKnoxmn
    Member

    I like the “Bug” message.. it works well and gets my attention.

    So I’ve done this now;

    function Orientation()
    {
    window.addEventListener(“deviceorientation”, handleOrientation, true);
    }// Orientation

    function handleOrientation(event)
    {
    var absolute = event.absolute;
    var alpha = event.alpha;
    var beta = event.beta;
    var gamma = event.gamma;
    } // Do stuff with the new orientation data

    function What Goes Here()
    {
    $(‘#m1-Learning-textField4’).val(event.beta); //and should val = Var alpha or beat or something else?
    $(‘#m1-Learning-textField5’).val(event.alpha);
    }

    at least now I’m still getting the lat / lon / alt to display, but no love on the angle and azimuth yet.

    SKnox

    #341803 Reply

    Unknown Author
    Participant

    Please tell me there’s an “All your base are belong to us” error message in there somewhere.

    -1TC

    #341809 Reply

    SKnoxmn
    Member

    Yeah, I didn’t want to bring that one up. “All your base…”

    But on the upside, I did comment out all aspects of my script which helped me keep track of what each piece was doing.

    So I was able to get it going, posting azimuth and angle to the text field on my form.

    Next will be the how to fire it off with an “onClick” and then have it stop once it gets the data.

    Lat Lon Altitude is a click once and it populates fine.

    angle / azimuth runs “onLoad” and keeps going.

    So, Id like an “OnClick” to fire off both and then stop.

    Im open to ideas,

    p.s. All your Base are belong to us.
    http://www.youtube.com/watch?v=8fvTxv46ano
    SKnox

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: I Haz Cheeseburger?!?!?!

You must be logged in to post in the forum log in