facebook

Map Widget (myeclipse build) Can’t Access Network

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

    TheThirdMan
    Member

    Using MyEclipse, I needed to update my network state reference from

    var networkState = navigator.connection.type;

    to

    var networkState = navigator.network.connection.type;

    I confirm that my app can access the network state.

    HOWEVER…the map widget still can’t access the network and still returns a “no network” error. Is this still a Cordova bug?

    #352846 Reply

    support-michael
    Keymaster

    >.the map widget still can’t access the network and still returns a “no network” error. Is this still a Cordova bug?

    I just rebuilt and ran my map widget test project using MyEclipse & PhoneGap Build. I only tested on an ios8 device. The map widget performed properly.

    General debugging questions that are required to isolate issue:

    What mobile platform and version are you one?

    Is this an existing mobione project?
    If yes and you have recently made changes to it, have you built it in MobiOne and confirmed proper operation?

    Are you using the Map api directly? If yes please describe and include snippets if possible.

    Do you have any error output from your app running in gapdebug?

    #352856 Reply

    TheThirdMan
    Member

    EDIT: My app _can_ access the network, but cannot trigger location services. The first time the app is installed, it never asks if the app can use location services. Compiled with PhoneGap 3.6.3. Again, I want to emphasize that all my code works perfectly in the Mobione Emulator and in the MyEclipse Emulator.

    ======================================
    >What mobile platform and version are you one?

    iOS8.1.1

    >Is this an existing mobione project?

    Yes.

    >If yes and you have recently made changes to it, have you built it in MobiOne and confirmed proper operation?

    In order to get to the bottom of this, I installed the confirmed operating iOS AppStore version of the app. It was confirmed operating under iOS 7. Since upgrading to iOS 8, the map widget constantly throws an error indicating that the map widget _can_ access the internet, but it cannot get geolocation lat/long from the iOS.

    >Are you using the Map api directly? If yes please describe and include snippets if possible.

    Using the Mobione map widget, with the necessary JavaScript to manipulate it. Launch code:

    function initialize(){
    if (intoInitialize==0){
    intoInitialize=1; //so that the map is only initialized once
    deleteOverlays(); //incase there are any
    var init = function() {
    $('[id$=map1]').gmapready(function(gmap) 
       {
        navigator.geolocation.getCurrentPosition(
        function(geoPosition) {
          var mapPos = new google.maps.LatLng(geoPosition.coords.latitude,geoPosition.coords.longitude);
         showLocation(gmap,mapPos);
                               },
         
        function() {
           phoneui.alert('Network connection lost', doNothing, 'No Network', 'OK');
                   }); //THIS ALERT THROWS EVERY TIME
         });
      }
    
    if ("PhoneGap" in window) {
        document.addEventListener("deviceready", init, false);
      } else {
        init();
      }  

    >Do you have any error output from your app running in gapdebug?

    GapDebug has never worked right. It can’t detect any app launch. Useless.

    I’m willing to submit the project files, but there are 3500 lines of custom JavaScript.

    #352861 Reply

    support-michael
    Keymaster

    I tested a showLocation mobione project built with MyEclipse & PhoneGap Build on an ios6+/ios8 device. The app includes a map widget and deviceready handler that accesses the device’s current location and centers the map on the position.

    Here’s a short screencast I created that demo’s the app and my use of gapdebug to install and debug it state:
    http://screencast.com/t/LGjPfcgfQ

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

    TheThirdMan
    Member

    Didn’t work. Updated all my code to match the example exactly – updated all map-ready calls to be inside deviceready listeners. Works perfectly in both emulators.

    GapDebug still as useless as ever, as it cannot detect launches.

    The app can’t trigger location services in iOS8.1.1.

    #352864 Reply

    TheThirdMan
    Member
    #352865 Reply

    support-michael
    Keymaster

    >Do I need to update the geolocation plugin in MyEclipse?

    My initial thought is no but its software and there could be something I’m missing. I followed the ios8 geolocation issue a few weeks ago and was under the impression it has been resolved. I also upgraded to ios 8.1.1 to match your env but no fail observed with my test app. Try other alternatives if you feel it can move you forward. The screencast I shared was created using PhoneGap Build and the project template provided as part of the tutorial. As the video shows my demo app request permission to use my current location.

    >GapDebug still as useless as ever, as it cannot detect launches

    Bummer! Without a debugging tool to peer into the operations of an app it could be difficult to isolate and fix an issue. Assuming your workstation has itunes installed (GapDebug needs the ios usb driver on windows) then the most common reason for an ios app to be undetectable by GapDebug (or Apple’s Safari WebKit Inspector) is the app is not signed with a developer certificate and developer profile. The “useless” feedback is disappointing, message received. I won’t mention it further.

    #352867 Reply

    TheThirdMan
    Member

    Two questions:

    1. Do I also need deviceready listeners for commands such as

    gmap.setZoom(13);

    ?

    2. Can iTunes and GapDebug work at the same time? Do they interfere with eachother? I’ve been able to get GapDebug to load an app onto my device, but just can’t detect launches.

    In the emulator, it works fine, but does pop this warning

    GET http://127.0.0.1:9090/get/INTERNAL_WEBSIM/cordova/rte-3.1.0.js 404 (Not Found) 

    Functionally, I have exactly the same code as you:

    function initialize(){
    if (intoInitialize==0){                                                         //only ever initialize once, intoInitialize set to 0 at beginning
    intoInitialize=1;
    key = 'Hotels';                                                                 //see if there are any settings stored yet
    var temp = localStorage.getItem(key);
    if (temp == null)
      {initializeSettings();}                                                      //if nothing in localstorage, populate settings
    deleteOverlays();                                                             //initialize map marker matrix
    document.addEventListener("deviceready",function() {           //the map code
    $('[id$=map1]').gmapready(function(gmap) 
       {   
        navigator.geolocation.getCurrentPosition(
        function(geoPosition) {
          var mapPos = new google.maps.LatLng(geoPosition.coords.latitude,
          geoPosition.coords.longitude);
          Googlepos=mapPos;                                                  //global variable, position capture for GooglePlaces query later
         showLocation(gmap,mapPos);
            },
         
        function() {                                                               //if map fails, throw an error message
           phoneui.alert('Network connection has been lost or Location Services are not turned on.', doNothing, 'No Network', 'OK');
                   });
         });
      }, false);
    
    
    function showLocation(gmap, pos) {
      gmap.setCenter(pos);                                                                       //center on user location
      var marker = new google.maps.Marker({                                               //throw a marker on the map
          position:  pos,
          map: gmap,
          title: "Current Location", 
          clickable: false,
       }); 
       marker.setIcon(iconFile);                                                                 //use the colored icon files downloaded from Google
       markersArray.push(marker);                                                             //put it into the marker array
    }
    scanmem();                                                                                     //referesh settings in local storage
    }
    }
    
    #352869 Reply

    TheThirdMan
    Member

    Using some good ol’ fashion alert() functions, I’m able to confirm that my app is crashing here:

    navigator.geolocation.getCurrentPosition(
        function(geoPosition) {
          var mapPos = new google.maps.LatLng(geoPosition.coords.latitude,
          geoPosition.coords.longitude);
    #352870 Reply

    DaveClark
    Participant

    I am not much of a programmer, but is that comma supposed to be there after the function declaration?

    function(geoPosition) {
    var mapPos = new google.maps.LatLng(geoPosition.coords.latitude,geoPosition.coords.longitude);
    showLocation(gmap,mapPos);
    },

    I am talking about the ending comma, is the comma right?

    #352911 Reply

    I know it seems basic but are the location services turned on for the app under Settings, Privacy, Location Services?

    When you say its crashing is it actually shutting down the app, or just getting the error alert that “Network Connection has been lost…” ?

    #352927 Reply

    TheThirdMan
    Member

    Location Services are on.

    The map loads the default location (hardcoded in Mobione), then pops the error message anytime there’s a call to get the phone’s latlng coordinates.

    #352935 Reply

    Hi,

    Can you send us a small Mobione test project that shows this error so that we can build and install in both MobiOne and MyEclipse to see what is going on and where the problem might be.

    Thanks,

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Map Widget (myeclipse build) Can’t Access Network

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