Reputation: 11
I have a problem with the last update of the google nearby connections API.
When I call start Discovery ()
or start Advertising ()
before the update I needed to pass a googleApiClient as a parameter.
After the update, I don't need to do this, but I still need to access the api with googleApiClient.
How can I run the sample without using googleApiClient?
private void startAdvertising() {
Nearby.getConnections(context).startAdvertising(
getUserNickname(),
SERVICE_ID,
mConnectionLifecycleCallback,
new AdvertisingOptions(STRATEGY))
.addOnSuccessListener(
new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void unusedResult) {
// We're advertising!
}
})
.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// We were unable to start advertising.
}
});
}
Upvotes: 1
Views: 440
Reputation: 2033
Use Nearby.getConnectionsClient(Context)
, to use the API without making a GoogleApiClient.
Upvotes: 1