Forums/Layer Development Platform/Layar Publishing Platform

Answered

layer works fine in testing page but not on device (Android)

matteosistisette
asked this on September 26, 2011 23:01

Hi,

I've created a layer following the example at http://layar.pbworks.com/w/page/44331092/First%20Layar%20Tutorial%20-%20Create%20a%20simple%20Geolocation%20layer

I've put just a couple of POIs

It's obviously in the Test phase. I can test it at the testing page and it works perfectly there: I can load POI's, they show up with all the info and no error. However,  when I try to test this on the device (an Android tablet), I always get 0 results even though I AM near to both the POIs within the range, so they should appear. They don't show up neither in map view nor in camera view, yet the map shows my correct current location, so there is GPS coverage.

 

What may I be missing? How is it possible that the test page can retrieve the POIs and the phone can't? If I am doing something wrong on the server side, shouldn't the test page also give the same results (or non-results)??

thanks

m.

 

Comments latest first

User photo
vogalonga

Do you use on your phone also layar version 6.0 ?

Or still 5.0 or something like that ? You can change on the testpage the version and test with 5.0

 

November 05, 2011 12:35
User photo
odienl

Hello,

I'm having a similar problem. POis are showing up on the Layer test page but when I try to test the layer on a phone i get "No results found.".

I have added tracing to my service and it seems the service doesn't even get called when I try to open it from a phone.

It's a geo layer build with API 6.0 and I included my JSON response with this post.

I have no idea what I did wrong here...

October 27, 2011 17:16
User photo
vogalonga

second time hi,

i had a lot of bugs and finally i found them all.

i tested everything with android. layar://mamgtest3d works also with android but not with symbian.

http://m.layar.com/open/mamgtest3d with this link it is the same problem.

 

October 17, 2011 19:43
User photo
vogalonga

hi,

i have a similar problem. i tested on the test page and it works fine. i tested on my phone and i got the message "error parsing server supply" and no results.

i have a symbian. first i wanted to test with the user authentification. but if i use 

header("Location: http://m.layar.com/open/mamgtest3d");

i 'm just leaded to the ovi-store where i can download layar again. and the other one don't work. the browser ( i tried opera and symbian browser )  is not able to open that page.

layar://mamgtest3d

so i delete the part with the user authentification and just public the layer, try and republic it again.

is that a problem with symbian ?

thanks for help !

 

 

October 06, 2011 21:17
User photo
xuan
staff

Hello All,

I saw some general questions in the conversation and I hope to make them a bit clear here:

1. We try to make the API test page as good as possible. Normally, if a layer works fine on the API test page, it will work on the actual device. However, we strongly recommend that you should always test your layer on the device since some features can only be tested on the device. 

2. For geo layers using API v6.0, they will work on current market version 5.0.3. However, if you have vision layer, it only works on the beta client v6.0 (Android).

3. About error messages on the API test page. We noticed that some layers which work fine on v5.0.3 dont work on beta client. We have changed the layar server to handle these. However, mostly it is because the JSON response is not returned according to the API doc. For instance, dimension should be an integer but not string. We will work on the error messages and try to make them reasonable. Please let us know when an error message does not make sense to you. If you see conflicts between different API versions, please firstly check the JSON response especially returned data type.

Hope this clears up something.

Best Regards,

Xuan

October 06, 2011 11:08
User photo
matteosistisette

@Oleksandr, when you testet my layer I had already changed a lot of things and now it is working with API5, not 6.

My original problem was that I was returning the lat and lon as string instead of floats, for example:

  "lat": "41.12343", "lon": "2.32434"

instead of 

  "lat": 41.22343, "lon": 2.3444

 

However, note that the error message is an absolute nonsense. Error messages MUST be meaningful and correct. A  wrong error message in response to wrong input is as serious an issue as a wrong behavior in response to valid input.

October 06, 2011 09:29
User photo
Oleksandr Lezvinskyi

Hello

When I tested your layer with API 6 in the filter I got an error 

"Required field 'url' is missing, Failed to validate field 'hotspots' list schema: "Required field 'url' is missing""

After that I checked your JSON response . For example

 

"id": "poi3",
"imageURL": "http://www.matteosistisette.com/layar/images/ied_.png",
"anchor": {
"geolocation": {
"lat": 41.40567,
"lon": 2.15327
}
},
"text": {
"title": "IED",
"description": ".................",
"footnote": ".........."
},
"dimension": 2,
"actions": [],
"object": {
"baseURL": "http://www.matteosistisette.com/layar/images/",
"full": "http://www.matteosistisette.com/layar/images/ied_.png",
"reduced": "http://www.matteosistisette.com/layar/images/ied_.png",
"icon": "http://www.matteosistisette.com/layar/images/ied_icon.png",
"size": 20,
"contentType": "image/vnd.layar.generic"
}

In API 6 we dont have field icon, you should create table icon which will have such field "id",  "url" and "type". That's why I got an error  "Required field 'url' is missing"

Please read this tutorial http://layar.pbworks.com/w/page/44331776/Third%20Layar%20Tutorial%20-%20layer%20with%201d%20icons%2C%202d%20images%20and%203d%20objects

October 06, 2011 08:36
User photo
David Wynd
Mine does similar with a slighty different error ode.
October 05, 2011 22:38
User photo
matteosistisette

Hm, I had configured my layer with API 6, but the current version of Layar Browser only supports API 5.0, right? So, now I've changed the settings of my layer to api 5. Now, in the test page, if I set API 5 in the filter settings, I get an error, which doesn't make much sense to me:

 

POI fwd url = http://www.matteosistisette.com/layar/endpoint?lang=en&countryC...
Response received from provider, validating...
response code : 200
error validating provider response - Traceback (most recent call last): File "/var/www/layar.com/app/api/handlers/api_layer/mainproxy.py", line 85, in validate_response data = validator.validate(response_as_dict, schema) File "/var/www/layar.com/app/api/jsontransmogrifier.py", line 560, in validate raise ValidationError(message=", ".join(self.errors), errors=self.errors) ValidationError: invalid literal for int() with base 10: '41.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.38', Failed to validate field 'hotspots' list schema: "invalid literal for int() with base 10: '41.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.38'"
JSON parse error( most likely)!, validate your response athttp://www.jsonlint.com/
invalid literal for int() with base 10: '41.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.38', Failed to validate field 'hotspots' list schema: "invalid literal for int() with base 10: '41.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.385150000041.38'"
Error: No content available


Those repeated numbers are NOT in the response, and if I validate the response as suggested, it is valid JSON.

With API 6 in the filter settings it works fine (in the test page), with API 5 in the filter settings it gives this error........ what does this mean??

September 26, 2011 23:21