Hello, (Sorry for my Engish, I'm french and don't speak english very well)
Let me come ask you for a little help because I can not coding in b4a a Java function that I found on the Net.
This function is intended to return the Latitude and Longitude of the "celltower" on which the GSM is connected:
http://android-coding.blogspot.fr/2011/06/convert-celllocation-to-real-location.html
I can without problems recovering the lac and cid:
I transferred my request through httpUtils2:
My problem is that I can not build my binary string :/
I watched a lot of posts and tutorials, and tested libraries "ByteConverter" and "RandomAccessFile" but without success.
How can I get the following string in my MyData variable:
Thanking you in advance for your help.
Let me come ask you for a little help because I can not coding in b4a a Java function that I found on the Net.
This function is intended to return the Latitude and Longitude of the "celltower" on which the GSM is connected:
http://android-coding.blogspot.fr/2011/06/convert-celllocation-to-real-location.html
I can without problems recovering the lac and cid:
B4X:
Dim r As Reflector
Dim cid, lac As Int
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "phone", "java.lang.String")
r.Target = r.RunMethod("getCellLocation")
cid = r.RunMethod("getCid")
lac = r.RunMethod("getLac")
I transferred my request through httpUtils2:
B4X:
Dim Http As HttpJob
Dim MyData as Byte
Http.PostBytes("http://www.google.com/glm/mmap",MyData)
My problem is that I can not build my binary string :/
I watched a lot of posts and tutorials, and tested libraries "ByteConverter" and "RandomAccessFile" but without success.
How can I get the following string in my MyData variable:
B4X:
DataOutputStream dataOutputStream = new DataOutputStream(out);
dataOutputStream.writeShort(21);
dataOutputStream.writeLong(0);
dataOutputStream.writeUTF("en");
dataOutputStream.writeUTF("Android");
dataOutputStream.writeUTF("1.0");
dataOutputStream.writeUTF("Web");
dataOutputStream.writeByte(27);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(3);
dataOutputStream.writeUTF("");
dataOutputStream.writeInt(cid);
dataOutputStream.writeInt(lac);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.flush();
Thanking you in advance for your help.