Courtesy: GitHub

Google APIs for Mobile: Quickstarts

Demonstrates streaming audio with the Nearby.Connections API to other nearby devices.

Getting Started

This sample uses the Gradle build system. To build this project, import the project into Android Studio before running it on (at least) 2 devices. This project comes with 2 build variants, Manual and Automatic, that demonstrate different ways of connecting the two devices. They can be toggled between in the Build Variants tab within Android Studio.

WalkieTalkie Manual

In the manual build variant, shake one device to begin advertising. As long as the app is open, other nearby devices should connect to it shortly. To speak, hold down the volume keys and your voice will be transmitted to the other devices you have connected to.

This demonstrates a star network, where one device advertises to a group of devices nearby.

WalkieTalkie Automatic

In the automatic build variant, devices simultaneously advertise and discover. Devices will begin to pair up as they connect to the first device they see. To speak, hold down the volume keys and your voice will be transmitted to the paired device.

This demonstrates a point to point network, where one device transmits a high bandwidth Payload to one other device.

Support

If you've found an error in these samples, please file an issue in this repo.

For providing feedback about Nearby.Connections, use the SEND FEEDBACK link on the Nearby Connections API for Android page.

Patches are encouraged, and may be submitted according to the instructions in CONTRIBUTING.md.

How to make contributions?

Please read and follow the steps in the CONTRIBUTING.md

License

See LICENSE

compileSdkVersion 25

minSdkVersion 16

targetSdkVersion 25

versionCode 1

versionName "1.0"

applicationId "com.google.location.nearby.apps.walkietalkie.manual"

applicationId "com.google.location.nearby.apps.walkietalkie.automatic"

compile fileTree(dir: 'libs', include: ['*.jar'])

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

compile 'com.android.support:appcompat-v7:25.3.1'

compile 'com.android.support:multidex:1.0.1'

package com.google.location.nearby.apps.walkietalkie

uses-permission

  • android.permission.BLUETOOTH
  • android.permission.BLUETOOTH_ADMIN
  • android.permission.ACCESS_WIFI_STATE
  • android.permission.CHANGE_WIFI_STATE
  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.RECORD_AUDIO
  • android.permission.VIBRATE

application android.support.multidex.MultiDexApplication

MainActivity