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?
Asked
Active
Viewed 3,362 times
1
-
the first time you try to access the camera the device will ask the user, you don't have to worry about this or show any message, it's handled by the system – jcesarmobile Nov 26 '15 at 11:31
2 Answers
1
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);
});

DaveAlden
- 30,083
- 11
- 93
- 155
0
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)
-
-
but small clarification for Notification permission also we need add any cordova plugin in iphone or just displaying simple dialog box will be enough – Nani Nov 26 '15 at 06:10
-
permissions are handled by the system the first time you try to use something that needs them, you don't have to worry about them or show any message – jcesarmobile Nov 26 '15 at 11:32