kevinjk / codetastrophe Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/codetastrophe
Automatically exported from code.google.com/p/codetastrophe
What steps will reproduce the problem?
1. run cupcake os
2. start CellFinder
3. Crash
What is the expected output? What do you see instead?
Map with cell site info. "Sorry! The application CellFinder (process
com.codetastrophe.cellfinder) has stopped unexpectedly. Please try again.
Force close"
What version of the product are you using? On what operating system?
CellFinder v1.3, Android OS v1.5
Please provide any additional information below.
Worked fine on Android OS v1.1
Original issue reported on code.google.com by [email protected]
on 2 Jun 2009 at 12:32
I thought this code might interest you, I cooked it up to get around
needing to turn on network location on my phone, frankly I just don't
want google knowing everything about me all the time.
If you want, you can use this code for anything you like under any
license you want.
private void getOpenCellID(String mcc, String mnc, int lac, int cid)
{
int shortcid = cid & 0xffff;
String surl = "http://www.opencellid.org/cell/get?key="+opencellidhash+
"&mcc="+mcc+"&mnc="+mnc+"&lac="+lac+"&cellid="+shortcid;
System.out.println("Cell Location changed? "+surl);
try
{
URL url = new URL(surl);
HttpURLConnection conn =
(HttpURLConnection)url.openConnection();
conn.connect();
int respcode = conn.getResponseCode();
DataInputStream dis = new
DataInputStream(conn.getInputStream());
byte[] data = new byte[1024];
int len = dis.read(data, 0, 1024);
dis.close();
conn.disconnect();
conn = null;
if(respcode == 200)
{
String d = new String(data, 0, len);
System.out.println("got cell location! "+d);
String range = d.substring(d.indexOf("range=\"")+7);
range = range.substring(0, range.indexOf("\""));
String lat = d.substring(d.indexOf("lat=\"")+5);
lat = lat.substring(0, lat.indexOf("\""));
String lon = d.substring(d.indexOf("lon=\"")+5);
lon = lon.substring(0, lon.indexOf("\""));
}
} catch (Exception e) {}
}
private void getEricsson(String mcc, String mnc, int lac, int cid)
{
int shortcid = cid & 0xffff;
String surl =
"http://cellid.labs.ericsson.net/json/lookup?key="+ericssonhash+
"&mcc="+mcc+"&mnc="+mnc+"&lac="+Integer.toHexString(lac)+
"&cellid="+Integer.toHexString(shortcid);
System.out.println("Cell Location changed? "+surl);
try
{
URL url = new URL(surl);
HttpURLConnection conn =
(HttpURLConnection)url.openConnection();
conn.connect();
int respcode = conn.getResponseCode();
DataInputStream dis = new
DataInputStream(conn.getInputStream());
byte[] data = new byte[1024];
int len = dis.read(data, 0, 1024);
dis.close();
conn.disconnect();
conn = null;
if(respcode == 200)
{
String d = new String(data, 0, len);
System.out.println("got cell location! "+d);
JSONObject tmp = new JSONObject(d);
tmp = tmp.getJSONObject("position");
int range =
(int)Double.parseDouble(tmp.getString("accuracy"));
double lat =
Double.parseDouble(tmp.getString("latitude"));
double lon =
Double.parseDouble(tmp.getString("longitude"));
}
} catch (Exception e) {}
}
Original issue reported on code.google.com by [email protected]
on 1 Nov 2009 at 8:00
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.