5,599,337 Members 38,281 Now Online
XDA Developers Android and Mobile Development Forum

Gear To Device Communication

Tip us?
 
taylordw
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Nov 2013
Prompt Gear To Device Communication

Hi All,
I'm very new to app development. I have created an app on my Note3 and a client on the Gear but im not sure how to get them talking. Does any one know if there is a Samsung api for doing this or can I just use BLE. Also does any one have a good BLE tutorial?

Thanks in advance.
 
Brendo
Old
#2  
Brendo's Avatar
Senior Member
Thanks Meter 408
Posts: 2,145
Join Date: Oct 2006
Location: Brisbane, Australia

 
DONATE TO ME
Quote:
Originally Posted by taylordw View Post
Hi All,
I'm very new to app development. I have created an app on my Note3 and a client on the Gear but im not sure how to get them talking. Does any one know if there is a Samsung api for doing this or can I just use BLE. Also does any one have a good BLE tutorial?

Thanks in advance.
We are still waiting for sdk to be released
Samsung Galaxy S IV (i9505) | 16GB
[ROM: Stock JB 4.3 | XXUEML6 | MODEM GSM/LTE: XXUEML4/XXUBMH1 | BL: PRE-KNOX | K: AUSDIM | RECOVERY: PhilZ]
DOMINATION | XPOSED

OTHER DEVICES:
 
Google Nexus 5 | 32GB

Samsung Galaxy Tab 8.9 (P7310) | 32Gb

[ROM: Jellybean 4.3 | CM10.2 | CPU: 1.4ghz]

Samsung Galaxy TabPro 10.1 (T520) | 16Gb

Pebble (Kickstarter)
Galaxy Gear (Null_)
Google Glass (Explorer)
--------
My Android Downloads
--------
OPTUS Post Paid | 3 UK PAYG | Orange France Pre Paid
 
appelflap
Old
#3  
appelflap's Avatar
Recognized Developer
Thanks Meter 786
Posts: 4,067
Join Date: Feb 2008
Location: Utrecht
Quote:
Originally Posted by taylordw View Post
Hi All,
I'm very new to app development. I have created an app on my Note3 and a client on the Gear but im not sure how to get them talking. Does any one know if there is a Samsung api for doing this or can I just use BLE. Also does any one have a good BLE tutorial?

Thanks in advance.
I don't see how you could use Bluetooth protocols for this kind of architecture. You can try to open a Bluetoothsocket and use your own script language to do the talking. http://developer.android.com/referen...othSocket.html

But I would wait for a SDK. Sony also has a SDK for their watches. It makes developing a lot easier with intent-based APIs
 
surlydre
Old
#4  
Junior Member
Thanks Meter 1
Posts: 2
Join Date: Oct 2010
Default BluetoothSocket

Quote:
Originally Posted by appelflap View Post
I don't see how you could use Bluetooth protocols for this kind of architecture. You can try to open a Bluetoothsocket and use your own script language to do the talking.

But I would wait for a SDK. Sony also has a SDK for their watches. It makes developing a lot easier with intent-based APIs
Thanks for the pointer, that works!

On the watch:
Code:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothServerSocket bss = btAdapter.listenUsingRfcommWithServiceRecord("Test", UUID.fromString("c3f10dc0-677b-11e3-949a-0800200c9a66"));
BluetoothSocket bs = bss.accept();
byte[] buf = new byte[1024];
InputStream is = bs.getInputStream();
int read = is.read(buf);
is.close();
bs.close();
On the phone:
Code:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> devices = btAdapter.getBondedDevices();
BluetoothDevice device = devices.iterator().next();
BluetoothSocket bs = device.createRfcommSocketToServiceRecord(UUID.fromString("c3f10dc0-677b-11e3-949a-0800200c9a66"));
bs.connect();
bs.getOutputStream().write("Hello!".getBytes("UTF-8"));
bs.getOutputStream().flush();
bs.getOutputStream().close();
bs.close();
This is just an example, but it works. Does anyone know if the the Bluetooth GATT APIs might be a better fit, and whether they might be able to control the lifecycle of the app on the watch?
The Following User Says Thank You to surlydre For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes