Jaspreet Singh
Jaspreet Singh

Reputation: 1180

How can i check the Bluetooth is ON or OFF in IOS?

I am using GameKit.framework for implementing Bluetooth in my app, but in didLoad I want to check if Bluetooth is turned on or turned off. Could anybody tell me how to do this?

Upvotes: 0

Views: 221

Answers (2)

nneonneo
nneonneo

Reputation: 179402

There's a private framework called BluetoothManager which can get the status easily. However, if you use it, your app will probably be rejected from the app store. So, only use this for apps you intend to distribute some other way.

Include this header in your project. Then you may write:

#import "BluetoothManager/BluetoothManager.h"

BluetoothManager *bt;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    bt = [[BluetoothManager alloc] init];
}

- (BOOL)getBluetoothEnabled {
    return [bt enabled];
}

Then, you just call getBluetoothEnabled.

Upvotes: 2

Maulik
Maulik

Reputation: 19418

You can't check with the current SDK. There is no Public API available for this.

Upvotes: 0

Related Questions