Traccar and Nominatim.

Anton Tananaev7 years ago

I'm not sure what you are evaluating, but you need some code to convert an array into string. That's what I meant.

vdovin7 years ago

http://joxi.ru/xAeLYXbSpMYqD2

I see what contain response. So something like this

vdovin7 years ago
l>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>replace</title>
<body>
<script language="JavaScript" type="text/javascript">
var pageName = '/';
if (('/' == pageName) || (pageName.indexOf('content.asp') != -1 )
|| (pageName.indexOf('mirror.asp') != -1)
|| (pageName.indexOf('insContent.asp') != -1)
|| (pageName.indexOf('ins2Content.asp') != -1)
|| (pageName.indexOf('content1.asp') != -1)
|| (pageName.indexOf('quicksetppp.asp') != -1)
|| (pageName.indexOf('quicksetwlan.asp') != -1)
|| (pageName.indexOf('quickconfig.asp') != -1))
{
top.location.replace(pageName);
}
else
{
top.contentfrm.location.replace(pageName);
}
</script>
</body>
</html>

response.getResponseBody()

Anton Tananaev7 years ago

You have to convert the array into a human readable string and see what's in there.

Anton Tananaev7 years ago

That's definitely not JSON, as you can probably see yourself.

vdovin7 years ago

Ok. I have response. I can create JsonReader from it.And from JsonReader I can get JsonObject.So if i correctly understood. I need JsonObject.
But when i try to read something from reader it will catch JsonException
Check this

Anton Tananaev7 years ago

You have provide a response which is NOT A JSON. How do you expect it to decode it?

Anton Tananaev7 years ago

I would recommend you think for a little before spamming this thread with more comments.

vdovin7 years ago

I try to explain how i understand this method.
First at all i call this :
Context.getAsyncHttpClient().prepareGet(String.format(url, latitude, longitude))
Then i get response here
public Object onCompleted(Response response)
So then I need to get Json from Response???

vdovin7 years ago

Thank you for your patience!!! I solved this problem. There is problem with url, so i change address to 192.168.1.4/nominatim/reverse.php. And it work. So it's only one problem why i can't put address as localhost

Anton Tananaev7 years ago

Is Nominatim on the same server as Traccar? I'm confused now because you've been telling that "localhost" worked and you provided some examples. Now you are saying that it doesn't.

vdovin7 years ago

Yes, nominatim is on the same server as Traccar. When I say that nominatim work at localhost I mean, that I could reverse geocoding through browser.So I don't know why ning async http client show me status 200(OK) and JsonException when I use localhost and status 200(OK) and address in database when I use 192.168.1.2/nominatim/reverse.php . But as a suitable solution I can make static ip address at computer.

Anton Tananaev7 years ago

So, did you use "localhost" in the browser?

vdovin7 years ago

Yes, when I try to connect to nominatim at computer with servers.