我有一个 AsyncTask 用于检查加速度计数据。当我检测到加速度计给出更大的值时,我需要开始 GPS 记录。
private LocationManager mlocManager;
private GPSLocationListener mlocListener;
..
mlocManager = (LocationManager)context.getSystemService(context.LOCATION_SERVICE);
mlocListener = new GPSLocationListener();
..
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 100, mlocListener);
mlocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10000, 100, mlocListener);
如何使这个运行?我得到的错误是
error occured while executing doInBackground()
Can't create handler inside thread that has not called Looper.prepare()