i try to display WMS layer from geoserver with openLayers Mobile,and its working great in the navigator (chrome) but its not appeering in the simulator device (android)...
& with another WMS layer like open street map , its working perfectly in both, web navigator and android device , so i can't figure out where the problem is , its been more then 10 days and i can't handle this problem..

this is my code:

var map;
    OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

    function init() {
        map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.Navigation(),
                    new OpenLayers.Control.PanZoomBar(),
                    new OpenLayers.Control.LayerSwitcher({'ascending':false}),
                    new OpenLayers.Control.ScaleLine(),                    
                    new OpenLayers.Control.MousePosition()                       

            var wms = new OpenLayers.Layer.WMS(
                "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0",
                {layers: "basic"}

           var osgeo = new OpenLayers.Layer.WMS("OpenLayers WMS",
                {layers: 'basic'},
                {isBaseLayer: true, transitionEffect: 'resize'}

          com = new OpenLayers.Layer.WMS(
            {layers: 'cite:matcommune_view', format: 'image/gif',transparent: true}

       map.addLayers([osgeo, com]);

map.setCenter(new OpenLayers.LonLat(-104, 42), 3);

1 Answer 1


You are adding the layer using the following piece of code:

com = new OpenLayers.Layer.WMS(
            {layers: 'cite:matcommune_view', format: 'image/gif',transparent: true}

If you read it carefully, you will see that you are calling it as localhost. Since the device is a different system, you will need to refer to it using a hostname, that is accessible from the virtual device. I usually use the IP address of the server.

Ideally, this application should be visible from outside of your internal network.(For example when you are testing on a real device with a cellular 3G network) For this, you will have to make sure that your Geoserver is accessible from outside. You will then have to give the external IP or the domain name.

  • finnaly its works for me.. ichanged "localhost" with my ip adress and its xorking great tks very much Mr.Devdatta Tengshe. this is an exemple : layer = new OpenLayers.Layer.WMS( "States WMS/WFS", "", {layers: 'topp:states', format: 'image/gif'} );
    – Ben Ayoub
    May 2, 2013 at 18:44
  • I'm glad to help you out. May 3, 2013 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.