最近项目需要,想要调用Android的定位功能,遂使用Luaj调用底层代码。我是这样调用的:
Main函数里面初始化GpsLocator
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PSNative.init(this);
PSNetwork.init(this);
PluginWrapper.init(this);
//GPS功能插入
GpsLocator.init(this);
}
调用在这里
System.out.println(“getLocation() successful called”);
if( locationMgr != null )
{
System.out.println(“locationMgr is ready”);
Location location = locationMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER);
System.out.println(“after get info from LocationManager.GPS_PROVIDER”);
if( location != null )
{
System.out.println(“location != null”);
double latitude = location.getLatitude();
double longitude = location.getLongitude();
String ret = “”+latitude+"|"+longitude;
return ret;
}
else
{
System.out.println(“location information is null”);
}
}
else
{
System.out.println( “Error LocationMgr is null” );
}
return “0|0”;
从log来看:是这句崩溃了: Location location = locationMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER);
提示:03-16 20
21.421: A/libc(12084): Fatal signal 11 (SIGSEGV) at 0xc5e7e070 (code=1), thread 12100 (Thread-1248)
求大神指点~
