双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

android里用了个百度定位的sdk出现如下错误

youdiving youdiving 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
08-12 23:55:42.527: W/System.err(2678): java.lang.NoSuchMethodException: startScan [boolean]
08-12 23:55:42.536: W/System.err(2678): at java.lang.Class.getConstructorOrMethod(Class.java:423)
08-12 23:55:42.536: W/System.err(2678): at java.lang.Class.getDeclaredMethod(Class.java:589)
08-12 23:55:42.536: W/System.err(2678): at com.baidu.location.e.try(Unknown Source)
08-12 23:55:42.547: W/System.err(2678): at com.baidu.location.f.onCreate(Unknown Source)
08-12 23:55:42.547: W/System.err(2678): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2577)
08-12 23:55:42.547: W/System.err(2678): at android.app.ActivityThread.access$1600(ActivityThread.java:141)
08-12 23:55:42.547: W/System.err(2678): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1338)
08-12 23:55:42.547: W/System.err(2678): at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 23:55:42.556: W/System.err(2678): at android.os.Looper.loop(Looper.java:137)
08-12 23:55:42.556: W/System.err(2678): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-12 23:55:42.556: W/System.err(2678): at java.lang.reflect.Method.invokeNative(Native Method)
08-12 23:55:42.556: W/System.err(2678): at java.lang.reflect.Method.invoke(Method.java:525)
08-12 23:55:42.556: W/System.err(2678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-12 23:55:42.566: W/System.err(2678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-12 23:55:42.566: W/System.err(2678): at dalvik.system.NativeStart.main(Native Method)
08-12 23:55:42.566: D/baidu_location_service(2678): baidu location service start1 ...2678
08-12 23:55:42.587: D/baidu_location_client(2602): baidu location connected ...
08-12 23:55:42.687: D/dalvikvm(2678): Trying to load lib /data/app-lib/com.example.baidugps-1/liblocSDK3.so 0x41750a08
08-12 23:55:42.718: D/dalvikvm(2678): Added shared lib /data/app-lib/com.example.baidugps-1/liblocSDK3.so 0x41750a08
08-12 23:55:42.718: D/dalvikvm(2678): No JNI_OnLoad found in /data/app-lib/com.example.baidugps-1/liblocSDK3.so 0x41750a08, skipping init
08-12 23:55:43.447: D/dalvikvm(2678): GC_FOR_ALLOC freed 301K, 14% free 2718K/3136K, paused 48ms, total 52ms


部分Java代码如下

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;
}
}


Location类
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

}
}


}




...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
youdiving
Android 80,489 成员 91,371 内容