在Blackberry 5.0中通过cellID获取位置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Blackberry 5.0中通过cellID获取位置相关的知识,希望对你有一定的参考价值。
public void cellID() { int cellID = GPRSInfo.getCellInfo().getCellId(); int lac = GPRSInfo.getCellInfo().getLAC(); try { /* Open a connection to Google Maps API */ ConnectionFactory connFact = new ConnectionFactory(); ConnectionDescriptor connDesc; connDesc = connFact.getConnection(urlString2); HttpConnection httpConn2; httpConn2 = (HttpConnection)connDesc.getConnection(); httpConn2.setRequestMethod("POST"); /* Write some custom data to Google Maps API */ WriteDataGoogleMaps(outputStream2, cellID, lac); /* Get the response */ /* Interpret the response obtained */ dataInputStream2.readShort(); dataInputStream2.readByte(); int code = dataInputStream2.readInt(); if (code == 0) { latitude = (double) dataInputStream2.readInt() / 1000000D; longitude = (double) dataInputStream2.readInt() / 1000000D; userLocation = new Coordinates(latitude,longitude,0); dataInputStream2.readInt(); dataInputStream2.readInt(); dataInputStream2.readUTF(); } else { } outputStream2.close(); inputStream2.close(); } } /** * Used to make the request to Google. */ dataOutputStream.writeShort(21); dataOutputStream.writeLong(0); dataOutputStream.writeUTF("en"); dataOutputStream.writeUTF("1.0"); dataOutputStream.writeUTF("Web"); dataOutputStream.writeByte(27); dataOutputStream.writeInt(0); dataOutputStream.writeInt(0); dataOutputStream.writeInt(3); dataOutputStream.writeUTF(""); dataOutputStream.writeInt(cellID); dataOutputStream.writeInt(lac); dataOutputStream.writeInt(0); dataOutputStream.writeInt(0); dataOutputStream.writeInt(0); dataOutputStream.writeInt(0); dataOutputStream.flush(); }
以上是关于在Blackberry 5.0中通过cellID获取位置的主要内容,如果未能解决你的问题,请参考以下文章
C ++:我在一种方法中获得了一个迭代器,如何在另一种方法中通过迭代器修改原始列表?
如何使用来自 blackberry 5.0 的 HTTP POST 上传音频文件?
如何在 BlackBerry 5.0 及更高版本的 J2ME 代码中使用 wifi 调用 web 服务? [复制]