2017-08-24 4 views
0

Ich habe kein Problem in all den Code für den Hintergrund GPS, aber ich habe nur Problem in dem Teil des LocationClient (es kann nicht aufgelöst werden)Was ist die Alternative von 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()); 

    } 

Hier ist der Teil, der nicht aufgelöst werden kann:

Location location = intent.getParcelableExtra(LocationClient.KEY_LOCATION_CHANGED); 
+0

Suchen Sie nach FusedLocationApi es ist die neuere API möglicherweise lösen Sie Ihr Problem –

+0

Verwenden Sie Google Play Service FusedLocationApi, die gibt bessere und genaue Ergebnis auf effiziente Weise –

Antwort

0

LocationClient ist veraltet, Sie müssen GoogleApiClient verwenden.

Verwandte Themen