I am trying to publish a simple text message using Nearby API but it is returning unknown status code = 2806.Here is my sample code
private void publish(String message) {
Log.i(TAG, "Publishing message: " + message);
mActiveMessage = new Message(message.getBytes());
if (!mGoogleApiClient.isConnected()) {
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect();
}
} else {
PublishOptions options = new PublishOptions.Builder()
.setStrategy(Strategy.DEFAULT)
.setCallback(new PublishCallback() {
@Override
public void onExpired() {
super.onExpired();
Log.i(TAG, "no longer publishing");
}
}).build();
Nearby.Messages.publish(mGoogleApiClient, mActiveMessage,options)
.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
if (status.isSuccess()) {
Log.i(TAG, "published successfully");
} else {
Log.i(TAG, "could not publish");
}
}
});
}
}
Do I need to add some special permission or anything else?