LocationClient的替代方案是什么?

时间:2017-08-24 19:50:40

标签: java android

我在后台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);

1 个答案:

答案 0 :(得分:0)

不推荐使用LocationClient,您必须使用GoogleApiClient。