Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 handel 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", "",
                {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);

im looking forward your help, tks.

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
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 '13 at 18:44
I'm glad to help you out. – Devdatta Tengshe May 3 '13 at 3:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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