Prarthana
Prarthana

Reputation: 87

Objective C-Is it possible to connect to BLE devices from iWatch?

Is it possible to get the BLE devices and connect to it using Watch Kit extension.In iPhone CoreBluetooth framework is used,what is the framework for iWatch

I am new to Watckit.Please help me with some solutions..

Upvotes: 1

Views: 883

Answers (2)

Prarthana
Prarthana

Reputation: 87

In iphone

if([WCSession isSuported])
{
WCSession *session=[WCSession defaultSession];
session.delegate=self;
[session activateSession];
}
NSError *error;
[session updateApplicationContext:@"DATA TO BE SEND" error:&error];

In iWatch repeat the session support check and add this code

-(void)session :(nonnull WCSession *)didRecieveApplicationContext:(nonull NSDictionary<NSString *,ud>*)applicationContext{

NSLog(@"recieved %@",applicationContext);
}

Upvotes: 0

lehn0058
lehn0058

Reputation: 20257

Core Bluetooth is not currently available on watchOS 2.

I'm not sure if this would work for your application, but you could "daisy chain" your connection. You would use core bluetooth to connect your device to your iPhone, and then you could interact with your iPhone using WCSession from your apple watch.

Upvotes: 2

Related Questions