I am trying to create a custom notification in my Unity3D game when the user does not give access to the camera in iOS. The reason I need access to camera is because I use Vuforia. Now Vuforia handles this care and you cannot play the game when the app does not have access to the camera and displays a very ugly pop up.
The thing is that my game has portions where can be played without access to the camera therefore I want to remove Vuforia's notification and find out how can I set my own(I just need to know what to check in order to see if the camera is accessible or not).
Thank you very much!
PS: I am using the latest versions of Unity3D and Vuforia.
So I solved it without Vuforia. I have created a small plugin the will check if the game has access to the camera and if it doesn't I'm deactivating the ar camera game object so no message will be displayed from Vuforia. Works perfectly.
In case you need here's the code for the unity plugin. This contains a boolean function that checks camera permissions and also a function that will open the settings app.
#import <AVFoundation/AVFoundation.h>
bool HasCameraPermissions()
{
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusAuthorized)
return true;
else
return false;
}
void OpenSettings () {
NSURL * url = [NSURL URLWithString: UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL: url];
}
save this in a .m file.