Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1069357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:24:43+00:00 2026-05-16T20:24:43+00:00

I am using Sencha Touch to develop a mobile version of a Bus Tracker

  • 0

I am using Sencha Touch to develop a mobile version of a Bus Tracker for Boston University. The problem I a running into is that the method setPosition() for a google.maps.Marker is not rendering the position change in Safari or any Mobile browser.

The code set up is as follows:

  • I initialize an empty markers array
  • I initialize the map using Ext.Map() (sencha call)
  • I load data using a JSONP request every 5 seconds interval
  • Every time I get new data, I check if I have a marker for that bus id inside my markers array
  • If I don’t I create a new marker and push it into my markers array
  • Otherwise I call setPosition with my new position on that marker in my markers array.
  • I then run a check to make sure the marker’s position got updated to the position received from my JSON request

I have verified (I think) that the marker inside the markers array is getting the new position everytime. Also, in Chrome and Firefox, my buses move (as expected), but in safari and iPhone/Android browsers, nothing moves.

Here is the code snippet:

var markers = {};
var busesFunc = function()
{
    Ext.util.JSONP.request({
        url: 'http://m.cms-devl.bu.edu/rpc/bus/livebus.json.php',
        callbackKey: 'callback',
        params: {
        },
        callback: function(data) {
            buses = data.ResultSet.Result;          

            for (var i = 0, ln = buses.length; i < ln; i++) {
                var bus = buses[i];

                var position = new google.maps.LatLng(bus.lat, bus.lng); 

                if(!markers[bus.id])
                {
                     markers[bus.id] = new google.maps.Marker({
                            map: map.map,
                            title: 'hello',
                            clickable: true,
                            draggable: false,
                            position: position,
                            icon: "images/bg.png",
                            zIndex: 100
                        });
                 }

                 markers[bus.id].setPosition(position);
                 //markers[bus.id].setIcon("images/bg.png");
                 //markers[bus.id].setMap(map.map);
                 //markers[bus.id].setMap(map.map);

                 if(bus.lat != markers[bus.id].position.lat()  || bus.lng != markers[bus.id].position.lng())
                 {
                    console.log(bus.id + " " + bus.lat + " " + bus.lng);
                    console.log(bus.id + " " + markers[bus.id].position.lat() + " " + markers[bus.id].position.lng());
                 }
            }
        }
    });
}
setInterval(busesFunc, 5000);

You can view the sample here: http://www.bu.edu/nisdev/students/luiscarr/liveBusMobile/

And the whole javascript is called functions.js (I can’t post more than one link)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:24:44+00:00Added an answer on May 16, 2026 at 8:24 pm

    Problem solved by making a unique request every interval. I figured it was a caching problem after some more debugging. So I added a timestamp parameter to the JSONP request and it was all fixed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop a mobile app using Sencha touch .I need to
I am using sencha touch beta 3 version at the moment. I have a
Iam using sencha touch for building mobile application, Ia m using card layout switch
I'm using Sencha touch 2. I have store that load from existing js object:
I am working on a mobile application and using sencha touch charts. By default
I've exactly the same problem from this Question . However I'm using Sencha Touch
Hi I recently started using Sencha-touch and I've come to understand that to bend
I am writing an application using Sencha Touch that will require a login to
I'm currently working on a mobile app (implemented using Sencha Touch 2 and designed
When using the [relatively new] MVC bits in Sencha Touch I find that 90%

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.