|
|
|
@ -74,38 +74,10 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
@Override
|
|
|
|
|
public void link(View view) {
|
|
|
|
|
|
|
|
|
|
LocationUtil.register(MainActivity.this, 0, 0, new LocationUtil.OnLocationChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void getLastKnownLocation(Location location) {
|
|
|
|
|
Log.e("xyh", "onLocationChanged: " + location.getLatitude());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onLocationChanged(Location location) {
|
|
|
|
|
//位置信息变化时触发
|
|
|
|
|
Log.e("xyh", "定位方式:" + location.getProvider());
|
|
|
|
|
Log.e("xyh", "纬度:" + location.getLatitude());
|
|
|
|
|
Log.e("xyh", "经度:" + location.getLongitude());
|
|
|
|
|
Log.e("xyh", "海拔:" + location.getAltitude());
|
|
|
|
|
Log.e("xyh", "时间:" + location.getTime());
|
|
|
|
|
Log.e("xyh", "国家:" + LocationUtil.getCountryName(MainActivity.this, location.getLatitude(), location.getLongitude()));
|
|
|
|
|
Log.e("xyh", "获取地理位置:" + LocationUtil.getAddress(MainActivity.this, location.getLatitude(), location.getLongitude()));
|
|
|
|
|
Log.e("xyh", "所在地:" + LocationUtil.getLocality(MainActivity.this, location.getLatitude(), location.getLongitude()));
|
|
|
|
|
Log.e("xyh", "所在街道:" + LocationUtil.getStreet(MainActivity.this, location.getLatitude(), location.getLongitude()));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
|
|
|
|
System.out.println("dfsad");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//连接设备
|
|
|
|
|
|
|
|
|
|
// Intent intent = new Intent(MainActivity.this, BottomActivity.class);
|
|
|
|
|
// startActivity(intent);
|
|
|
|
|
Intent intent = new Intent(MainActivity.this, BottomActivity.class);
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
// String s = binding.ip.getText().toString();
|
|
|
|
|
// if (RegexUtil.checkIpAddress(s)) {
|
|
|
|
|
//获取可adb调试的设备列表
|
|
|
|
|