80,471
社区成员




public void onClick(View arg0) {
// TODO Auto-generated method stub
if(mIsStart==false)
{
starBtn.setText("停止");
mIsStart=true;
setLocationOption();
locationClient.start();
locationClient.requestLocation();//返回定位(经纬度)到OnReceived()的参数location里面(异步返回)
String longitude=((Location)getApplication()).longitude;
String altitude=((Location)getApplication()).altitude;
values2.clear();
values2.add("12345678910");
values2.add(longitude);
values2.add(altitude);
Thread thread=new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
HttpConnSoap soap=new HttpConnSoap();
InputStream in= soap.GetServer("AddPoint","http://dingwei.aybm.cn/LocateWs.asmx", para2, values2);
}
});
thread.start();
}
else
{
locationClient.stop();
starBtn.setText("开始");
mIsStart=false;
}
}
public class Location extends Application{
public LocationClient mLocationClient=null;
private String mdata;
public TextView mTV;
public MyLocationListener myLocationListener=new MyLocationListener();
String longitude="";
String altitude="";
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
mLocationClient=new LocationClient(getApplicationContext());
mLocationClient.registerLocationListener(myLocationListener);
}
public class MyLocationListener implements BDLocationListener{
public MyLocationListener() {
super();
}
@Override
public void onReceiveLocation(BDLocation arg0) {
// TODO Auto-generated method stub
if(arg0==null)
return;
TelephonyManager mTelephoneMgr=(TelephonyManager)getSystemService(getApplicationContext().TELEPHONY_SERVICE);
String imsi=mTelephoneMgr.getSubscriberId();
StringBuffer sb=new StringBuffer(256);
sb.append("phonenumber(imsi):"+imsi);
sb.append("\nlatitude:");
sb.append(arg0.getLatitude());
sb.append("\nlongitude:");
sb.append(arg0.getLongitude());
longitude=String.valueOf(arg0.getLongitude());
altitude=String.valueOf(arg0.getAltitude());
if(mTV!=null)
{
mTV.setText(sb.toString());
}
}
@Override
public void onReceivePoi(BDLocation arg0) {
// TODO Auto-generated method stub
}
}
}