You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Dan Polivy <da...@cellartracker.com> on 2014/09/29 23:17:51 UTC
[Camera] iOS8: Handle case where camera is not authorized?
Hi folks,
I'm working on iOS 8/iPhone 6 compatibility for my Cordova app, and one thing that's new in iOS 8 is the ability to enable/disable access to the camera on a per-app basis, for all regions. (Previously, I think this was only limited to certain regions such as China.)
As of iOS 7, there's a new API to test whether the app has access to capture the desired media type:
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/index.html#//apple_ref/occ/clm/AVCaptureDevice/authorizationStatusForMediaType:
[AVCaptureDevice authorizationStatusForMediaType:mediaType];
I didn't see any existing issues or discussion on this topic, so thought I'd bring it up here. Is detecting this scenario, and popping up a UIAlertView notifying the user (and offering a button to take them to the settings app), a reasonable addition to the camera plugin? I'm happy to put together a PR and file an issue if you think it's worth adding.
Thanks,
Dan
(I'm not on the dev list, so please include me directly in all replies.)
RE: [Camera] iOS8: Handle case where camera is not authorized?
Posted by Dan Polivy <da...@cellartracker.com>.
Thanks, Jesse. JIRA issue is created for this:
https://issues.apache.org/jira/browse/CB-7667
I have a code change locally that seems to work well for me. Shall I put it in a PR, or paste the code into the bug? It does require AVFoundation (to call the API below), and some localized strings to display in the alert dialog – though the latter could be handled by the JS caller if necessary.
Dan
From: Jesse [mailto:purplecabbage@gmail.com]
Sent: Monday, September 29, 2014 4:15 PM
To: dev@cordova.apache.org
Cc: Dan Polivy
Subject: Re: [Camera] iOS8: Handle case where camera is not authorized?
Thanks Dan!
Please create an issue in JIRA [1]
You can assign component "iOS, Plugin Camera, Plugin Capture"
This looks pretty easy to fix, so I don't think you'll have to wait long.
Cheers,
Jesse
[1] https://issues.apache.org/jira/browse/CB/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel
@purplecabbage
risingj.com<http://risingj.com>
On Mon, Sep 29, 2014 at 2:17 PM, Dan Polivy <da...@cellartracker.com>> wrote:
Hi folks,
I'm working on iOS 8/iPhone 6 compatibility for my Cordova app, and one thing that's new in iOS 8 is the ability to enable/disable access to the camera on a per-app basis, for all regions. (Previously, I think this was only limited to certain regions such as China.)
As of iOS 7, there's a new API to test whether the app has access to capture the desired media type:
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/index.html#//apple_ref/occ/clm/AVCaptureDevice/authorizationStatusForMediaType:
[AVCaptureDevice authorizationStatusForMediaType:mediaType];
I didn't see any existing issues or discussion on this topic, so thought I'd bring it up here. Is detecting this scenario, and popping up a UIAlertView notifying the user (and offering a button to take them to the settings app), a reasonable addition to the camera plugin? I'm happy to put together a PR and file an issue if you think it's worth adding.
Thanks,
Dan
(I'm not on the dev list, so please include me directly in all replies.)
Re: [Camera] iOS8: Handle case where camera is not authorized?
Posted by Jesse <pu...@gmail.com>.
Thanks Dan!
Please create an issue in JIRA [1]
You can assign component "iOS, Plugin Camera, Plugin Capture"
This looks pretty easy to fix, so I don't think you'll have to wait long.
Cheers,
Jesse
[1]
https://issues.apache.org/jira/browse/CB/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel
@purplecabbage
risingj.com
On Mon, Sep 29, 2014 at 2:17 PM, Dan Polivy <da...@cellartracker.com> wrote:
> Hi folks,
>
> I'm working on iOS 8/iPhone 6 compatibility for my Cordova app, and one
> thing that's new in iOS 8 is the ability to enable/disable access to the
> camera on a per-app basis, for all regions. (Previously, I think this was
> only limited to certain regions such as China.)
>
> As of iOS 7, there's a new API to test whether the app has access to
> capture the desired media type:
>
>
> https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/index.html#//apple_ref/occ/clm/AVCaptureDevice/authorizationStatusForMediaType
> :
>
> [AVCaptureDevice authorizationStatusForMediaType:mediaType];
>
> I didn't see any existing issues or discussion on this topic, so thought
> I'd bring it up here. Is detecting this scenario, and popping up a
> UIAlertView notifying the user (and offering a button to take them to the
> settings app), a reasonable addition to the camera plugin? I'm happy to put
> together a PR and file an issue if you think it's worth adding.
>
> Thanks,
> Dan
>
> (I'm not on the dev list, so please include me directly in all replies.)
>
>