BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-05-2008, 12:37 PM   #1 (permalink)
New Member
 
Join Date: May 2008
Model: 8830
PIN: N/A
Carrier: bell
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Newby question

Please Login to Remove!

I'm developping a mobile web site that will be accessible by blackberry devices with a built in gps receiver and i'm having some problem with some javascript i think... here is one of my page
Code:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <% if( ( TempData["ErrorMsg"] ?? ViewData.ErrorMsg ) != null ){ %>
    <p class="error">
        <% =TempData["ErrorMsg"] ?? ViewData.ErrorMsg %></p>
    <% } %>
    
    <%using (Html.Form<PunchController>(p => p.GetNextView(Guid.NewGuid()), FormMethod.Post, new { _id = "formindex" }))
      { %>
    <%=string.Format(GTSResources.GetLocalizedText("CurrentStateMsg"), ViewData.CurrentState)%>
    <br />
    <br />
    <%=GTSResources.GetLocalizedText("CurrentStateChoiceMsg")%>
    <%=Html.Select("DesiredState", ViewData.PossibleStateTransition)%>
    <%=Html.Hidden("GpsCoordinate", null)%>
    <%=Html.Hidden("PreviousPage", "Index")%>
    <br />
    <br />
    <%=Html.SubmitButton("submit", GTSResources.GetLocalizedText("SubmitBtnText"), new { _onclick = "SetGps();"})%>
    <%} %>

    <script type="text/javascript">
    function SetGps()
    {
        if(blackberry.location.GPSSupported)
        {
            blackberry.location.setAidMode(1);
            blackberry.location.refreshLocation();
            document.formindex.elements['GpsCoordinate'].value = blackberry.location.latitude + "," + blackberry.location.longitude;
        }
        window.alert(document.formindex.elements['GpsCoordinate'].value);
        return true;
    };
    </script>

</asp:Content>
The problem is that the GpsCoordinate gets updated the first time only, all request after shows the same gps coordinate as previous. Would it be a problem with the javascript? I've also noticed that if a break into the server code and wait for 5 seconds before continuing, the gpsCoordinate gets updated correctly?? strange?

My second question is regarding a second application that would be running in the background on the device. I would like to record the gps coordinate every 30 seconds and send them to a web service on my server via http. Can this be achieve without using mds as my client does not have it and my provider (bell mobility) does not seem to have apn. Could i just be sending http request with this background application and use the browser for my mobile web site in the same time?

Any pointer and comment will be very appreciate.
thanks
mateo
Offline  
Old 05-05-2008, 06:52 PM   #2 (permalink)
New Member
 
Join Date: May 2008
Model: 8830
PIN: N/A
Carrier: bell
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default not updating

Nobody??

the location is only updated once? I even tried to make a button just show the coordinate without posting back and the coordinate doesnt change?
Is this the correct behavior of the javascript?

Please help
Offline  
Old 05-06-2008, 10:38 AM   #3 (permalink)
New Member
 
Join Date: May 2008
Model: 8830
PIN: N/A
Carrier: bell
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok i think i found why...

i realized that if i click on a link before the page as been completely received (the blue arrow in the top right corner is still showing activity) then the coordinate would not update but if i wait till it dissapear then the coordinate is updated..

Someone knows why?

But now is there a way to prevent a user from clicking till the page is entirely received? What could possibly be going on if the page is rendered correctly, everything seems to be there but the blue arrow stays there for at least 5 seconds?

Thanks
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.