🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
1 Tag Serie
🤖 Android Tipps 🕛 kürzlich 4 Min Lesezeit
0

Reduce friction with the new Location APIs

↗ Quelle (feedproxy.google.com)
🗣️ Stimme:
📑 Inhaltsübersicht
Posted by Aaron Stacy, Software Engineer, Google Play services


The 11.0.0 release of the Google Play services SDK includes a new way to access
.


Why not use GoogleApiClient?



The LocationServices APIs allow you to access device location, set up geofences,
prompt the user to enable location on the device and more. In order to access
these services, the app must connect to Google Play services, which can involve
error-prone connection logic. For example, can you spot the crash in the app
below?



Note: we'll assume our app has the
ACCESS_FINE_LOCATION permission, which is required to get the
user's exact location using the LocationServices APIs.




public class MainActivity extends AppCompatActivity implements
GoogleApiClient.OnConnectionFailedListener {

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

GoogleApiClient client = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(LocationServices.API)
.build();
client.connect();

PendingResult result =
LocationServices.FusedLocationApi.requestLocationUpdates(
client, LocationRequest.create(), pendingIntent);

result.setResultCallback(new ResultCallback() {
@Override
public void onResult(@NonNull Status status) {
Log.d(TAG, "Result: " + status.getStatusMessage());
}
});
}

// ...
}


If you pointed to the requestLocationUpdates() call, you're right!
That call throws an IllegalStateException, since the
GoogleApiClient is has not yet connected. The call to
connect() is asynchronous.



While the code above looks like it should work, it's missing a
API which makes it easier to compose asynchronous operations.

  • The code is self-contained and could easily be moved into a shared utility
    class or similar.
  • You don't need to understand the underlying connection process to start
    coding.
  • What happened to all of the callbacks?



    The new API will automatically resolve certain connection failures for you, so
    you don't need to write code that for things like prompting the user to update
    Google Play services. Rather than exposing connection failures globally in the
    :




        client.requestLocationUpdates(LocationRequest.create(), pendingIntent)
    .addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception e) {
    if (e instanceof ApiException) {
    Log.w(TAG, ((ApiException) e).getStatusMessage());
    } else {
    Log.w(TAG, e.getMessage());
    }
    }
    });

    Try it for yourself



    Try the new LocationServices APIs out for yourself in your own app
    or head over to the

    Vollständiger Original-Bericht
    Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf feedproxy.google.com.
    ↗ Original-Artikel auf feedproxy.google.com lesen
    Wie bewertest du diesen Beitrag?
    1 Klick Feedback
    Teilen mit Netzwerk & Team:

    Community-Analysen & Experten-Meinungen 0

    Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
    Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
    Community Pulse: Relevanz-Einschätzung
    1 Klick Experten-Votum
    🔴 Akute Relevanz 0%
    🟡 In Evaluierung 0%
    🟢 Keine Auswirkung 0%
    Spannende Innovation 0%
    Verwandte Story-Cluster & Quellen (Vektor-KI)
    Port 8095 Engine
    3 Quellen
    GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
    1 Quelle
    Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
    1 Quelle
    Major AI platforms go down in unprecedented simultaneous outage