0
我在後臺GPS所有的代碼沒有問題,但我只有在LocationClient的部分問題(無法解析)LocationClient的替代方案是什麼?
protected void onHandleIntent(Intent intent) {
Location location = intent.getParcelableExtra(LocationClient.KEY_LOCATION_CHANGED);
if (location != null) {
Log.i(TAG, "onHandleIntent " + location.getLatitude() + "," + location.getLongitude());
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Builder noti = new NotificationCompat.Builder(this);
noti.setContentTitle("Sks Location Client");
noti.setContentText(location.getLatitude() + "," + location.getLongitude());
// noti.setSmallIcon(R.drawable.ic_la);
notificationManager.notify(1234, noti.build());
}
這裏是一個解決不了的部分:
Location location = intent.getParcelableExtra(LocationClient.KEY_LOCATION_CHANGED);
尋找FusedLocationApi其較新的api可能會解決您的問題 –
使用Google Play服務的FusedLocationApi這是一個有效的方式給出更好和準確的結果 –