0

I need to transfer Call Audio routing from Bluetooth Headset to iPhone Device and vice versa, if Bluetooth device is paired.

Any help will be appreciated ?

Jas_meet
  • 366
  • 1
  • 20

1 Answers1

1

Below is the set of code I used to change Call Audio routing from Bluetooth Headset to iPhone Speaker in iOS programatically

MPAVRoutingController* routingController = [[MPAVRoutingController alloc] init];
[routingController setDiscoveryMode:1];
[routingController fetchAvailableRoutesWithCompletionHandler: ^{
 NSMutableArray* arr = [[NSMutableArray alloc] init];
 for (MPAVRoute* route in [routingController availableRoutes]) {
        [arr addObject:route];
    }

 NSPredicate* predicate = [NSPredicate predicateWithFormat: @"routeUID contains %@", @"Speaker"];

 NSArray* val = [arr filteredArrayUsingPredicate:predicate];
    if ([val count] > 0) {
        [routingController pickRoute:val[0]];
    }
}];

The API's used are Apple Private API's

Jas_meet
  • 366
  • 1
  • 20