Presenting camera permission dialog in iOS 8

Here is the approach we ended up using: if ([AVCaptureDevice respondsToSelector:@selector(requestAccessForMediaType: completionHandler:)]) { [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { // Will get here on both iOS 7 & 8 even though camera permissions weren’t required // until iOS 8. So for iOS 7 permission will always be granted. if (granted) { // Permission has been granted. … Read more

How do I open the “front camera” on the Android platform?

private Camera openFrontFacingCameraGingerbread() { int cameraCount = 0; Camera cam = null; Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); for (int camIdx = 0; camIdx < cameraCount; camIdx++) { Camera.getCameraInfo(camIdx, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { try { cam = Camera.open(camIdx); } catch (RuntimeException e) { Log.e(TAG, “Camera failed to open: ” + e.getLocalizedMessage()); … Read more

How to set Android camera orientation properly?

From other member and my problem: Camera Rotation issue depend on different Devices and certain Version. Version 1.6: to fix the Rotation Issue, and it is good for most of devices if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { p.set(“orientation”, “portrait”); p.set(“rotation”,90); } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { p.set(“orientation”, “landscape”); p.set(“rotation”, 90); } Version 2.1: depend on kind … Read more

AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection?

I used this code once to capture iOS default shutter sound (here is list of sound file names https://github.com/TUNER88/iOSSystemSoundsLibrary): NSString *path = @”/System/Library/Audio/UISounds/photoShutter.caf”; NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; NSData *data = [NSData dataWithContentsOfFile:path]; [data writeToFile:[docs stringByAppendingPathComponent:@”photoShutter.caf”] atomically:YES]; Then I used third-party app to extract photoShutter.caf from Documents directory (DiskAid for Mac). Next step … Read more

UIImagePickerController error: Snapshotting a view that has not been rendered results in an empty snapshot in iOS 7

The problem in iOS7 has to do with transitions. It seems that if a previous transition didn’t complete and you launch a new one, iOS7 messes the views, where iOS6 seems to manage it correctly. You should initialize your Camera in your UIViewController, only after the view has Loaded and with a timeout: – (void)viewDidAppear:(BOOL)animated … Read more

Android – Camera preview is sideways

This issue appeared to start out as a bug with certain hardware see here but can be overcome by using the call to mCamera.setDisplayOrientation(degrees) available in API 8. So this is how I implement it: public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if (isPreviewRunning) { mCamera.stopPreview(); } Parameters parameters = mCamera.getParameters(); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)