triniwiz / nativescript-videorecorder

:video_camera: NativeScript plugin for Video Recording . :video_camera:
Apache License 2.0
43 stars 29 forks source link

angular4 update - camera permission needed #18

Closed ButterMeWaffle closed 7 years ago

ButterMeWaffle commented 7 years ago

After up[dating the angular 4 I was met with this error when trying to open the camera. camera permission needed. I have run into this in the past and cant remember what I did to resolve it. However this time I do believe it has to do with the angular 4 update. Any ideas on how to fix this?

edit - I DID check and i currently have the correct permissions approved for the application. This is only as Android

ButterMeWaffle commented 7 years ago

After testing on a few different devices I have found that the issue is only with devices running android 7.0.

ButterMeWaffle commented 7 years ago

Ok so I have done soem more investigation and have found something that I believe may be the cause of this issue.

So when you check for the permissions you are using this android.Manifest.permission.CAMERA I decided to console log this value and see what I get, its returns as a string equal to android.Manifest.permission.CAMERA. So this made me do some digging into the nativescript-permissions plugin so see how they did it. I found this var hasPermission = android.content.pm.PackageManager.PERMISSION_GRANTED == android.support.v4.content.ContextCompat.checkSelfPermission(getContext(), perm); this code is a bit mroe similar to the docs on how to check for permission. particularly the ContextCompat portion.

I believe swapping out the method for the one above will fix this issue

ButterMeWaffle commented 7 years ago

I believe the above is incorrect. sorry.

triniwiz commented 7 years ago

The new update should take of this

MehdiAroui commented 7 years ago

I install version 2.0.1 and still have that problem, on android 6 nativescript-angular 3.1.3

ButterMeWaffle commented 7 years ago

@MehdiAroui to resolve the issue for android 7.0 and higher you need to request the following permissions.

CAMERA RECORD_AUDIO **** this is the one most people forget about WRITE_EXTERNAL_STORAGE READ_EXTERNAL_STORAGE

Hope this helps.