Code Monkey home page Code Monkey logo

android-nearby's People

Contributors

brianduff avatar codingjeremy avatar ezralopez avatar flavius-mester avatar francozappa avatar knjk04 avatar naokigoogle avatar paep3nguin avatar reznor avatar samtstern avatar shailen avatar tjohns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-nearby's Issues

Nearby.CONNECTIONS_API is not available on this device.

When I use "compile com.google.android.gms:play-services-nearby:11.8.0" and use Nearby.getConnectionsClient() to advertise or discover,I meet blow problem,how can I resolve it?
Thank you very much!

1 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: com.google.android.gms.common.api.ApiException: 17: API: Nearby.CONNECTIONS_API is not available on this device.
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.api.internal.zzb.zzs(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.api.internal.zzd.zzs(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.api.internal.zzbo.zzw(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.api.internal.zzbo.onConnectionFailed(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.internal.zzad.onConnectionFailed(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.internal.zzn.zzj(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.internal.zze.zzw(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.internal.zzi.zzaks(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at android.os.Looper.loop(Looper.java:148)
02-11 19:55:17.871 27502-27502/com.dewmobile.kuaiya.neartrans W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)

Device discovered, but error code 8005 returned on slave device when trying to connect.

I have A problem with connecting specific devices using this application. Sample works fine for Nexus 7 + Nexus 5, and Nexus 7 + Samsung Galaxy S3, however, when I try to connect Nexus 5 to Samsung Galaxy S3 (and vice versa), I always get result 8005. Both devices are connected to the same WiFi, and it does support mDNS discoverability. Any idea what might be the problem?

Could not find dependency "com.google.android.gms:play-services-nearby:14.0.0"

Hi,

I'm not able to import the walkietalkie app. I'm using:

Android Studio 3.0.1
Build #AI-171.4443003, built on November 9, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.113-1-MANJARO

I'm getting the following error from gradle:

Could not find dependency "com.google.android.gms:play-services-nearby:14.0.0"

Nearby API doesn't work without internet connection

I try to run the sample with internet connection turned off, and retrieve following error on Nearby.Messages.Subscribe

W/MainActivity: Could not subscribe, status = Status{statusCode=NETWORK_ERROR, resolution=null}

Checked on Nexus 5x android 6.0.1 and Nexus 6 android 5.1.1
Nearby permission granted, bluetooth is turned on.

I think there was a possibility to work without internet connection when I checked this sample few months ago.
Is Nearby supposed to work offline now?

Following sample receive "Attempting to perform a high-power operation from a non-Activity Context"

I follow your instruction using google api version 9.4.0, and receive Attempting to perform a high-power operation from a non-Activity Context... i tried initialize using enable auto-manage and tried also managing my self.... here i attach my code

public class MainActivity extends AppCompatActivity
        implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

    private static final int REQUEST_RESOLVE_NEARBY = 1001;
    private static final String TAG = "MainActivityTAG";

    private GoogleApiClient mGoogleApiClient;
    private Message mMessage;
    private MessageListener mMessageListener;

    private SwitchCompat switchPublish, switchSubscribe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mMessage = new Message(StringUtils.stringToByteArr("Fsoeltoni"));
        mMessageListener = new MessageListener() {
            @Override
            public void onFound(Message message) {

            }

            @Override
            public void onLost(Message message) {
                super.onLost(message);
            }
        };

        createGoogleApiClient();
        mGoogleApiClient.connect();

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        switchPublish = (SwitchCompat) findViewById(R.id.switch_publish);
        switchPublish.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
                    if (b) {
                        publish();
                    } else {
                        unpublish();
                    }
                }
            }
        });

        switchSubscribe = (SwitchCompat) findViewById(R.id.switch_subscribe);
        switchSubscribe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
                    if (b) {
                        subscribe();
                    } else {
                        unsubscribe();
                    }
                }
            }
        });


        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_RESOLVE_NEARBY) {
            if (resultCode == RESULT_OK) {
                mGoogleApiClient.connect();
            } else {
                Toast.makeText(this, R.string.toast_error_google_api_client, Toast.LENGTH_SHORT).show();
            }
        }
    }

    @Override
    public void onConnected(@Nullable Bundle bundle) {
        if (switchPublish.isChecked()) {
            publish();
        }
        if (switchSubscribe.isChecked()) {
            subscribe();
        }
    }

    @Override
    public void onConnectionSuspended(int i) {
        switchPublish.setEnabled(false);
        switchSubscribe.setEnabled(false);
        Toast.makeText(this, R.string.toast_error_google_api_client, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
        if (connectionResult.hasResolution()) {
            try {
                connectionResult.startResolutionForResult(this, REQUEST_RESOLVE_NEARBY);
            } catch (IntentSender.SendIntentException e) {
                e.printStackTrace();
            }
        } else {
            Toast.makeText(this, R.string.toast_error_google_api_client, Toast.LENGTH_SHORT).show();
        }
    }

    private void createGoogleApiClient() {
        if (mGoogleApiClient == null) {
            mGoogleApiClient = new GoogleApiClient.Builder(this)
                    .addApi(Nearby.MESSAGES_API)
                    .addConnectionCallbacks(this)
                    .enableAutoManage(this, this)
                    .build();
        }
    }

    private Strategy mStrategy = new Strategy.Builder()
            .setTtlSeconds(Strategy.TTL_SECONDS_MAX)
            .setDistanceType(Strategy.DISTANCE_TYPE_DEFAULT)
            .setDiscoveryMode(Strategy.DISCOVERY_MODE_BROADCAST)
            .build();

    private PublishOptions mPublishOptions = new PublishOptions.Builder()
            .setStrategy(mStrategy)
            .setCallback(
                    new PublishCallback() {
                        @Override
                        public void onExpired() {
                            super.onExpired();
                            Log.i(TAG, "stop publishing");

                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    switchPublish.setChecked(false);
                                }
                            });
                        }
                    }).build();

    private SubscribeOptions mSubscribeOptions = new SubscribeOptions.Builder()
            .setStrategy(mStrategy)
            .setCallback(
                    new SubscribeCallback() {
                        @Override
                        public void onExpired() {
                            super.onExpired();
                            Log.i(TAG, "stop subscribing");

                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    switchSubscribe.setChecked(false);
                                }
                            });
                        }
                    }).build();

    private void publish() {
        Nearby.Messages.publish(mGoogleApiClient, mMessage, mPublishOptions)
                .setResultCallback(
                        new ResultCallback<Status>() {
                            @Override
                            public void onResult(@NonNull Status status) {
                                if (status.isSuccess()) {
                                    Log.i(TAG, "published");
                                } else {
                                    if (status.hasResolution()) {
                                        try {
                                            status.startResolutionForResult(MainActivity.this, REQUEST_RESOLVE_NEARBY);
                                        } catch (IntentSender.SendIntentException e) {
                                            e.printStackTrace();
                                        }
                                    } else {
                                        Log.e(TAG, "publish failed : " + status.getStatusMessage());
                                        Toast.makeText(MainActivity.this, status.getStatusMessage(), Toast.LENGTH_SHORT).show();
                                    }
                                }
                            }
                        });
    }

    private void unpublish() {
        Nearby.Messages.unpublish(mGoogleApiClient, mMessage)
                .setResultCallback(
                        new ResultCallback<Status>() {
                            @Override
                            public void onResult(@NonNull Status status) {
                                if (status.isSuccess()) {
                                    Log.i(TAG, "unpublished");
                                } else {
                                    if (status.hasResolution()) {
                                        try {
                                            status.startResolutionForResult(MainActivity.this, REQUEST_RESOLVE_NEARBY);
                                        } catch (IntentSender.SendIntentException e) {
                                            e.printStackTrace();
                                        }
                                    } else {
                                        Log.e(TAG, "publish failed : " + status.getStatusMessage());
                                        Toast.makeText(MainActivity.this, status.getStatusMessage(), Toast.LENGTH_SHORT).show();
                                    }
                                }
                            }
                        });
    }

    private void subscribe() {
        Nearby.Messages.subscribe(mGoogleApiClient, mMessageListener, mSubscribeOptions)
                .setResultCallback(
                        new ResultCallback<Status>() {
                            @Override
                            public void onResult(@NonNull Status status) {
                                if (status.isSuccess()) {
                                    Log.i(TAG, "subscribed");
                                } else {
                                    if (status.hasResolution()) {
                                        try {
                                            status.startResolutionForResult(MainActivity.this, REQUEST_RESOLVE_NEARBY);
                                        } catch (IntentSender.SendIntentException e) {
                                            e.printStackTrace();
                                        }
                                    } else {
                                        Log.e(TAG, "publish failed : " + status.getStatusMessage());
                                        Toast.makeText(MainActivity.this, status.getStatusMessage(), Toast.LENGTH_SHORT).show();
                                    }
                                }
                            }
                        });
    }

    private void unsubscribe() {
        Nearby.Messages.unsubscribe(mGoogleApiClient, mMessageListener)
                .setResultCallback(
                        new ResultCallback<Status>() {
                            @Override
                            public void onResult(@NonNull Status status) {
                                if (status.isSuccess()) {
                                    Log.i(TAG, "unsubscribed");
                                } else {
                                    if (status.hasResolution()) {
                                        try {
                                            status.startResolutionForResult(MainActivity.this, REQUEST_RESOLVE_NEARBY);
                                        } catch (IntentSender.SendIntentException e) {
                                            e.printStackTrace();
                                        }
                                    } else {
                                        Log.e(TAG, "publish failed : " + status.getStatusMessage());
                                        Toast.makeText(MainActivity.this, status.getStatusMessage(), Toast.LENGTH_SHORT).show();
                                    }
                                }
                            }
                        });
    }
}

API 28 and androidx: RockPaperScissors build fails with "Program type already present"

I can't seem to get Android Nearby Connections to build on API 28 in my project.
At first, I thought it was my project only but it turns out RockPaperScissors is broken in the same way and I suspect it's related to dependencies from the GMS libs.

Building the debug APK, the ':app:transformDexArchiveWithExternalLibsDexMergerForRelease' task always fails with a message such as
Error: Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback

Exactly which "Program type" is reported may vary. The release APK build also fails.

Please refer to the gist (patch) below. I'm running Android Studio 3.2 Beta 2
https://gist.github.com/carlrobert-sonymobile/f8fb438185727633b8e73d61a1de0cf3

Images

Is it possible to transmit images? since the Connections.MAX_RELIABLE_MESSAGE_LEN is just about 4 KB's

No getSize() on Payload object?

In the exchange data Connections API doc page, getSize() is being called on a payload object (last line in the code snippet below) in buildNotification().

private NotificationCompat.Builder buildNotification(Payload payload, boolean isIncoming) {
  NotificationCompat.Builder notification = new NotificationCompat.Builder(this);
      .setContentTitle(isIncoming ? "Receiving..." : "Sending...");
  int size = payload.getSize();

However, Android Studio is telling me that there isn't such a method (I do have the Payload, PayloadCallback and PayloadTransferUpdate imports). I couldn't find getSize() being used in any of the samples on this repository, so I was wondering whether it (still?) exists?

If it does exist and I am doing something wrong, I'd like to suggest that a code sample be made that closer resembles the documentation boilerplate code.

Nearby Connections support for iOS

As now we are not able to implement Nearby Connections for iOS so that we can communicate between Android and iOS.

As well as we can see the delay in sending the message by "Nearby Messages" between iOS devices.

Sample code:

func subscribeValue(){
      guard let gnsManager = gnsManager else {
          return
      }
      
      subscribtion = gnsManager.subscription(messageFoundHandler: { (message: GNSMessage?) in
          if let message = message, !message.content.isEmpty {
              self.subscribedMessage.text = "Message found: \(String.utf8encoded(data: message.content)!) \(message.messageNamespace!) \(message.type!)"
          }
      }, messageLostHandler: { (message: GNSMessage?) in
          guard let message = message else { return }
      }, paramsBlock: {(params: GNSSubscriptionParams?) in
          guard let params = params else { return }
          
          params.statusHandler = {(status: GNSOperationStatus) in
          }

          params.strategy = GNSStrategy(paramsBlock: { (strategyParams) in
              strategyParams?.discoveryMediums =  .BLE
              strategyParams?.discoveryMode = .scan
          })
      })
  }

func publishData(){
      let valueInString = "\(value)"
      let message = GNSMessage(content: valueInString.data(using: .utf8))
      nearbyPublication = gnsManager?.publication(with: message,
                                                  paramsBlock: { (params: GNSPublicationParams?) in
          guard let message = message else { return }
          guard let params = params else { return }
          
          params.permissionRequestHandler = { (permissionHandler: GNSPermissionHandler?) in
              self.updateLog("Microphone permission error")
          }
          params.statusHandler = { (status: GNSOperationStatus) in
          }
          
          params.strategy = GNSStrategy(paramsBlock: { (strategyParams) in
               strategyParams?.discoveryMediums = .BLE
              strategyParams?.discoveryMode = .broadcast
          })
      })
  }

Is there any better way to send data ?

Stale Nearby Notifications?

I had a Beacon registered to Google Nearby and then created a new notification. I got this notifications just fine on my LG G4 Android phone. Later, I deleted the old notification and created a newer notification for the same beacon. However, I still keep getting the same old notification (that doesn't exist anymore for the beacon) in addition to the new notification. I verified this again and again on the Google Beacon Dashboard that the old notification does not exist for the beacon. I tried this with a third new notification (after deleting the others) and I now see all 3 notifications showing up. Where is this stale data coming from even though I see no evidence of the old notification's existence in the Beacon dashboard for the Beacon? Is this a known bug in Google Nearby Notifications?

nearby doesn't work on xiaomi phone

Installed this sample nearby devices app in a Xiaomi Mi3 and Xiaomi Redmi 2 phone respectively, but couldn't receive any response after each phone subscribed and published. However, when a third phone join in to subscribe also, Nexus 6 (in my case), then only both subscribers will receive message published from publisher. Wonder is't devices specific issue or other causes.

Beacon not found

I have kontakt.io Smart Beacon and this sample not find my beacon. I try switch between Eddystone and iBeacon profil, but it is still the same.
Official app by konkakt.io find beacon.
My own app which list beacons in area also works.
These applications don´t use Google Nearby, but I can write app with background scanning beacons with Google Nearby

I have Oneplus One and Samsung Galaxy S6 with Android 6 and bluetooth 4.

Unnecessary semi-colon in progress updates section on API doc page

I don't know if this is the right place to post this, but if not, please let me know who I need to direct this towards.

On the Nearby connections API page in the exchange data section in the progress updates section, I think there is a mistake in the code sample (buildNotification method).

  NotificationCompat.Builder notification = new NotificationCompat.Builder(this);
      .setContentTitle(isIncoming ? "Receiving..." : "Sending...");

I don't think there should be a semi-colon at the end of the first line in the code snippet above. When included, it raises an error ("cannot resolve method 'setContentTitle(java.lang.String)'"). Without, it's fine (and I think that's the usual way of working with Builders).

null payloadFile (API documentation page)

In the exchange data page, there is the following line of code:

File payloadFile = filePayload.asFile().asJavaFile();

The rest of my code is similar to the documentation page. payloadFile is always null, however (I know Android Studio flags asJavaFile() as possibly throwing a null pointer exception, but I don't see why it is always null).

Is this an issue with the API itself or likely to be an issue on my end (if it's on my side, I'll ask a question on StackOverflow)?

Multiplayer P2P game connection problem

  1. Currently i am working on a multiplayer P2P game using nearby api. For that i am using P2P_star strategy. Players can invite and join. But unfortunately we don't have the option to select the host or client from the UI, so the whole topology creation should be autonomous. So is there any way to know from the api which device is the master after the creation of P2P_star. Because i need to know the master to propagate the game info to other devices. And please suggest me the way or good practices, nearby suggest to implement multiplayer p2p games.

  2. First every devices are Advertising and Discovering both and trying to find the pair. And when any end point found that request connection. I often getting onFailure callback with the following exceptions randomly: STATUS_BLUETOOTH_ERROR, STATUS_OUT_OF_ORDER_API_CALL, STATUS_ENDPOINT_IO_ERROR etc. Currently when i get onFailure callback i stop discovering and start again after sometimes(1000ms). I keep the advertising running(not stoping and starting).
    Am i doing this right or you have any other suggessions in my usecase?

Documentation: not initialising the file payload

Documentation code snippet for sending a file using a ParcelFileDescriptor:

Payload filePayload;
    try {
      // Open the ParcelFileDescriptor for this URI with read access.
      ParcelFileDescriptor pfd = getContentResolver().openFileDescriptor(uri, "r");
      filePayload = Payload.fromFile(pfd);
    } catch (FileNotFoundException e) {
      Log.e("MyApp", "File not found", e);
      return;
    }

    // Construct a simple message mapping the ID of the file payload to the desired filename.
    String filenameMessage = filePayload.getId() + ":" + uri.getLastPathSegment();

    // Send the filename message as a bytes payload.
    Payload filenameBytesPayload =
        Payload.fromBytes(filenameMessage.getBytes(StandardCharsets.UTF_8));
    Nearby.getConnectionsClient(context).sendPayload(endpointId, filenameBytesPayload);

    // Finally, send the file payload.
    Nearby.getConnectionsClient(context).sendPayload(endpointId, filePayload);
  • If the Payload is not initialised before the try/catch block, Java will complain on the
    String filenameMessage = filePayload.getId() + ":" + uri.getLastPathSegment();
    line. I suggest initialising it to null

I've followed the feedback link provided on the walkie talkie README, but I couldn't find SEND FEEBACK on the page anywhere (it isn't the options menu and I've used CTRL+F to search for it).

Fetch Eddystone UID using Nearby Messages API

Is there a provision in Nearby Messages API to get the beacon's details like if the Beacon is configured on Eddystone UID is it possible to fetch it's Namespace and Instance ID or UUID, Major and Minor in the case of registered IBeacon.

Buttons does not fit in the approval dialog

We recently integrated the new Nearby Messages API into our app and noticed that the approval dialog's buttons does not fit in the approval dialog when we use the application in hungarian language. I attached some screenshots about the bug, this is what we see when we use the app in english:
english
And this is the hungarian version:
hungarian

As you can see the Allow button is missing from the dialog.

Discovery onEndpointLost never called?

onEndpointFound is successfully called, but onEndpointLost never receives an event for some reason.

If I kill the advertiser and restart it, I then get duplicate keys inserted into onEndpointFound.

Basically, I'm always stuck with my "discovered" endpoints even when they stop advertising and/or go out of range.

clientSingleton.startDiscovery(
	getServiceId(),
	new EndpointDiscoveryCallback() {
		@Override
		public void onEndpointFound(String endpointId, DiscoveredEndpointInfo info) {
			if (serviceId.equals(info.getServiceId())) {
				Endpoint endpoint = new Endpoint(endpointId, info.getEndpointName());
				mDiscoveredEndpoints.put(endpointId, endpoint);
				onEndpointDiscovered(endpoint);
			}
		}

		@Override
		public void onEndpointLost(String endpointId) {
			//Log.d("NearbyConnectionModule", "ENDPOINT LOST!");
			onEndpointLost(endpointId);
		}
	}, discoveryOptions)
.addOnSuccessListener(
	new OnSuccessListener<Void>() {
		@Override
		public void onSuccess(Void unusedResult) {
			onDiscoveryStarted();
		}
	}
).addOnFailureListener(
	new OnFailureListener() {
		@Override
		public void onFailure(@NonNull Exception e) {
			mIsDiscovering = false;
			onDiscoveryStartFailed(e.getMessage());
		}
	}
);

Strategy.DISTANCE_TYPE_EARSHOT does not restrict proximity

The video on the documentation website claims that EARSHOT distance restricts the message proximity to about 5 feet (1.5 meter), but that is not actually the case. It even works if the distance is about 10 meters (I haven't tested longer distances). Any comments on this?

ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null, message=null}

Implemented this sample on mobile & tablet everything is perfect ! But whit Android TV ADT-1 v5.0.2 build LRX22G these eloquent message shows up.

GmsClient: unable to connect to service: com.google.android.gms.nearby.messages.service.NearbyMessagesService.START
D/NearbyMessagesClient: Failed to emit client lifecycle event ACTIVITY_STOPPED due to GmsClient being disconnected
NearbyMessagesClient: Failed to emit client lifecycle event CLIENT_DISCONNECTED due to GmsClient being disconnected

The callback :

@Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) 

Output :

ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null, message=null}

Like I said, everything works in the mobile module. I doubled checked API_KEY, gradle dependencies, Manifest meta, nope, I even created a listing for the APK and created a Game on Google Play Console, nothing.

Any ideas ? Thanks !

Programmatically present the “Configure Nearby” Settings page in the device’s Settings app.

Hello, this is an enhancement request.

There is no way listed in the Settings documentation to open the “Configure Nearby” settings page (Settings>Personal>Google>Nearby>Configure Nearby). Based on the Allowing Other Apps to Start Your Activity documentation there might be Intent filters on some manifest file to explain how to build the Intents to take the user to the “Configure Nearby” settings page. But I am unsure how to obtain this info.

With a couple of examples on Stack Overflow and some guess work I was able to open up some Google setting pages (Ads, Location, Device) but not “Configure Nearby”.

If the page “Configure Nearby” is not possible, how about the page right before it? It is the “Nearby” page that shows any links found.

Can the sample Nearby apps provide an example on how to do this?

Thanks,

Error:(195, 35) error: cannot find symbol class Builder

Hi,

I'm trying to Build and Run the walkietalkie app from your repo.

I've changed the dependecy entry to

compile 'com.google.android.gms:play-services-nearby:11.8.0'

However when I try to build the project I'm getting two errors of this type:

error: cannot find symbol class Builder

Given by the following two lines of code:

new AdvertisingOptions.Builder().setStrategy(getStrategy()).build())
new DiscoveryOptions.Builder().setStrategy(getStrategy()).build())

I'm using

Android Studio 3.0.1
Build #AI-171.4443003, built on November 9, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.113-1-MANJARO

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.