Hi we are developing an IBM MobileFirst Platform-based Hybrid Application. In our application we are accessing user gallery (to upload photos). for this in iPhone we need to ask the user permission explicitly, to ask user permission in iPhone we need to display dialog box. Here my question is the dialog box which we are going to show to the user is custom dialog box or is there any native feature built-in in MobileFirst, or with the help of any cordova plugin?
You can use requestCameraRollAuthorization() in cordova-diagnostic-plugin to request native iOS permission to access the user photos:
cordova.plugins.diagnostic.requestCameraRollAuthorization(function(granted){
console.log("Authorization request for camera roll was " + (granted ? "granted" : "denied"));
}, function(error){
console.error(error);
});
MobileFirst does not handle any permissions for you - it is not that kind of a framework. This really relates to the Cordova layer in your app, which access the photo library.
You need to display a dialog box asking the user whether or not does s/he allow for the access to access the photo library. You can use WL.SimpleDialog for this purpose, for example.
Read more here:
http://docs.phonegap.com/en/3.3.0/guide_appdev_privacy_index.md.html#Privacy%20Guide
Cordova Camera Plugin in IOS 9
perhaps to check if there is access given, create also a Cordova plug-in that will check for it using native code: Determine if the access to photo library is set or not - PHPhotoLibrary (iOS 8)
Related
According to those SO questions: UIImagePickerController not asking for permission and No permission to pick a photo from the photo library
If you want to select one image on iOS, you don't have to ask for permission to do it as the app doesn't actually access the gallery.
However, I can't find a way of doing it Flutter. Packages like ImagePicker always ask for permission.
Has anyone succeeded in picking an image in Flutter on iOS without asking for permission?
From Apple documentation:
PHPickerViewController is a new picker that replaces UIImagePickerController. Its user interface matches that of the Photos app, supports search and multiple selection of photos and videos, and provides fluid zooming of content. Because the system manages its life cycle in a separate process, it’s private by default. The user doesn’t need to explicitly authorize your app to select photos, which results in a simpler and more streamlined user experience.
This library uses PHPickerViewController as seen here
The old UIImagePickerController allowed it on older iOS'es, but it has been deprecated, since iOS 14.
The Flutter ImagePicker plugin uses the PHPicker in the iOS code, as I checked for their code on Github, and it allows you to pick an image from the user without requesting permissions. I recommend highly to use that plugin.
Try file_picker it should work for you as it supports all the platform including IOS and Mac supporting various types of file type, you can specify your custom file types also limiting your file selections as well as you can pick files from cloud (GDrive, Dropbox, iCloud)...
First of all add the latest file_picker as a dependency in your pubspec.yaml file.
Import this dependency in file wherever you want to use and then you are good to go...
for picking single file use this code:
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
File file = File(result.files.single.path);
} else {
// User canceled the picker
}
files with extension filter:
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'pdf', 'doc'],
);
You can find detailed usage Here
you can find the documentation Here
I am displaying a html page using WKWebview in Swift 5. I have an option to upload image using input file tag. When I run the app and click on upload, it prompts to select Photo library or Camera. If I select camera, app crashes since the app doesn't have permission.
How to remove camera option or properly request the permission when the user select camera?
I am not sure but you can just set key Privacy - Camera Usage Description in info.plist file with description. Web view will manage for permission and it will work. Please check and let me know if work for you.
I am using the Web SDK for Agora.io and trying to implement video chat feature and have screen sharing enabled. I am having this error generated:
MediaError "Access to screen denied."
Could anyone please help me out?
Which platform are you using to test the screen sharing?
Agora's screen sharing does not work in Safari, and needs a plugin to run in Chrome. Only FireFox supports screen-sharing out of the box.
The plugin process is available within the Agora documentation: https://docs.agora.io/en/Video/screensharing_web?platform=Web
This question already has an answer here:
IBM Worklight - Using the camera in BlackBerry
(1 answer)
Closed 8 years ago.
Platform: Black berry 6 and 7
Framework: IBM Worklight
Description:
I am developing an image-scanning application for BlackBerry. The application takes the user to a success page if the correct image is scanned and a failure page is shown on scanning an incorrect image.
Scenario:
I have developed HTML pages for this app, now I need to put transition from HTML page to camera page of Black berry i.e. I have a button on my HTML page labelled as 'Scan Image', on clicking/taping this button camera should open and start scanning images, So my question is :
How that transition can be done, I mean what is the javascript syntax to navigate from HTML page to native camera page?
This is the exact same question as you have asked TODAY, here: IBM Worklight - Using the camera in BlackBerry
Why do you ask again?
There is no "transition" involved. You use the JavaScript API provided by either Apache Cordova or BlackBerry themselves to access the camera, take a picture and handle the success or failure.
Please stop for a moment to write your app. Create a demo app and implement ONLY the camera support; if it works, start implementing it the way you want to, in your app.
Use the Camera API provided by BlackBerry
Use the Camera API provided by Apache Cordova
Please take the time to read the pages and the examples.
There are clear instructions on how to add permission for using the Camera and clear code examples on how to implement it.
http://docs.phonegap.com/en/2.6.0/cordova_camera_camera.md.html#Camera
My application only gets image and it's metadata from ios device using ALAssetsLibrary.
When application starts loading images list ios warning is shown..
"Application" Would Like to Use Your Current Location.
This allows access to location information in photos and videos.
Is there way to fix program code in such way that this warning not to be shown? (not by using Setting->General....)
I think user doesn't understand why application during picking the image asks about location.
If you need the metadata info, using assetslibrary is your only option. Using Alassetslibrary means that the user grants permission to location services. The simple reason for that is that the photos metadata might contain location/gps data.
Cheers,
Hendrik
UPDATED: It will not request access permission in iOS 6. You can check the client's [[UIDevice currentDevice]systemVersion] while using ALAssetsLibrary.