Esri / quickstart-map-phonegap

ArcGIS JavaScript samples for use with PhoneGap/Cordova
35 stars 37 forks source link

map.on("load", startGeolocation) not calling the "startGeolocation" function in windows phone 8 #11

Closed sadiq-mc closed 8 years ago

sadiq-mc commented 8 years ago

The map.on("load", startGeolocation) is not executing the function. Because of that the map is not getting displayed in the div. Once I pinch the screen, then the map displays.

Am adding a point in the startGeolocation. As the map is not loaded completely, the point is also not displayed.

Help me to fix it.

andygup commented 8 years ago

Are you able to remote debug the device to see if there are any console errors? Do you see the message Cordova device ready event?

If you aren't able to remote debug then you can place alerts in the code to act as breakpoints. Start by placing an alert statement before the require and see if it gets triggered.

sadiq-mc commented 8 years ago

Yes.. the device ready event is printing in the console.. I did debugging by placing alerts before require, inside require and both displayed.. But the one I placed inside startGeolocation function which is called once the map is loaded didn't fire.

andygup commented 8 years ago

You mentioned you can see the debug console, can you post a screenshot of all the console messages from when you first start the app until it stops loading?

After that, here are some other things to try:

1) Instead of listening for the load event, you could try layer-add.

2) Create a non-PhoneGap version of the app and debug it on Windows Desktop. Reference: http://stackoverflow.com/questions/14567491/windows-phone-8-ie10-javascript-debugging

3) Run the phone in debugger mode in Visual Studio and debug the app that way.

sadiq-mc commented 8 years ago

Got it..!! Thank you for your support.. Added the dojo script tag and the map loaded successfully..

Windows: Now stuck with an issue in graphicsUtils.. Am plotting a few points in a loop and after that I get the extend using graphicsUtils.graphicsExtent(features) to set the extent to include all the points in the extend... The map is failing here to and so the map is not displaying now.. :(

Once if I remove the extent code, the points are plotted and the map is displayed.

Android: Another scenario, In my hybrid app I have two languages supports, English & Arabic.. For English the map displays without any issue.. But when I switch the language to Arabic and load the map, it moves to right side of the screen.

andygup commented 8 years ago

For windows, verify that a valid Extent is being returned and that no errors are being thrown. If nothing is being returned and you aren't seeing any errors, you may need to place that code in a try/catch block.

On the Android issue, make sure you read the ArcGIS API for JavaScript localization doc. Here are some easy tweaks to try:


<script type="text/javascript">
  dojoConfig = {
    locale: "ar",
    parseOnLoad: true
  };
</script>
sadiq-mc commented 8 years ago

Thank you.. The issue regarding the map moved to right was a css issue... I am placing a css class in <html> tag.. Just updated this one and the problem was solved.. Thank you @andygup

andygup commented 8 years ago

Good deal, I'll go ahead and close this issue out then.