[英]What is the alternative of LocationClient?
我在后台GPS的所有代碼中都沒有問題,但是我在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);
不推薦使用LocationClient,您必須使用GoogleApiClient。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.