Blackberry camera permission - blackberry

One of the features incorporated in my app is QR code scanning. The problem is, user will be asked for camera permission before scanning. I think this could make the users confused.
Is there any way to bypass this, or something to set all the required permissions during installation, so users don't need to set this manually?
I already heard about ApplicationPermissions, but still not sure how to use it.

You cannot set requested permissions in the JAD file as you can (I believe) in J2ME, but you can query the permissions which are set at runtime.
You are on the right track with ApplicationPermissions: when your app starts you would do something like this, for instance to request permission to access the file system:
ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
if(apm.getPermission(ApplicationPermissions.PERMISSION_FILE_API) != ApplicationPermissions.VALUE_ALLOW) {
ApplicationPermissions ap = new ApplicationPermissions();
ap.addPermission(ApplicationPermissions.FILE_API);
apm.invokePermissionsRequest(ap);
}

I found the Answer.
It is working with following code. And will not ask for permission when scanning QR code.
ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
ApplicationPermissions ap = new ApplicationPermissions();
ap.addPermission(ApplicationPermissions.PERMISSION_RECORDING);
apm.invokePermissionsRequest(ap);

Related

Windows 10 constantly prompts for permission to use precise location

I have a very simple application that uses realtime location data to obtain relevant information, developed in C# as a UWP 10.0 application.
My interaction with the geolocation API is very simple: I only checked Location in the "Package Manifest" under "Capabilities" and I only use the following API call:
var locator = new Windows.Devices.Geolocation.Geolocator();
var location = await locator.GetGeopositionAsync();
When this call is first made, Windows 10 throws up an "Allow this application to use your precise location [yes | no]" dialog. Selecting "yes" seems to "save" this choice for around 5 minutes or so; subsequent attempts at obtaining the user's position within the next five minutes go through (I believe they return the cached value, as it never seems to change), but more than 5 minutes later, the permission dialog is always shown once more (even though the user has already authorized it).
From my reading of the geolocation API documentation on MSDN, I can find nothing to suggest that this is the intended behavior. Under privacy settings in the metro control panel, this application is under the list of apps allowed to use the precise location. What's more, other apps in that list with precise location enabled have never prompted me to allow them access to the precise location past the first time.
What am I doing wrong here and how can I prevent this dialog from constantly popping up?
EDIT
With await Geolocator.RequestAccessAsync(), the permissions are cached so long as the exe is not modified/re-compiled.
I was able to replicate your problem. But according to official documentation, it clearly mentions, that you need to call RequestAccessAsync() before any calls.
So when I made change from your lines of codes, to below, permission Request window showed up only once and subsequent calls were made directly.
GeolocationAccessStatus accessStatus = await Geolocator.RequestAccessAsync();
if (accessStatus == GeolocationAccessStatus.Allowed)
{
Geolocator locator = new Geolocator();
Geoposition location = await locator.GetGeopositionAsync();
locText.Text = location.Coordinate.Point.Position.Latitude + Environment.NewLine + location.Coordinate.Point.Position.Longitude;
}

iOS Application crashing on use of CMPedometer functions

I have a Xamarin.iOS application where I am using this guide to make use of the CMPedometer floors ascended property. Here is some relevant code on my single view app:
CMPedometer pedometer;
...
public override async void ViewDidLoad(){
base.ViewDidLoad();
if (CMPedometer.IsFloorCountingAvailable)
{
pedometer = new CMPedometer();
//app crashes here:
pedometer.StartPedometerUpdates(new NSDate(), UpdatePedometerData);
var data = await pedometer.QueryPedometerDataAsync((NSDate)DateTime.SpecifyKind(DateTime.Now.AddHours(-24), DateTimeKind.Utc), (NSDate)DateTime.Now);
UpdatePedometerData(data, null);
}
}
My very basic app crashes when I try to get updates from my CMPedometer with little error output. This is what I get:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
which may be an issue with my app permissions? If that's the case I am not sure how to grant/ask permissions on using the CDPedometer. Thanks for any help
Got this link. You have to add privacy setting for motion in your plist
https://blog.xamarin.com/new-ios-10-privacy-permission-settings/
Thanks to #panthor314 for getting me pointed in the right direction. Unfortunately the blog link above is dead, but this seems to be the new location for this information:
https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/security-privacy?tabs=windows
This link explains:
Apps that fail to provide the required keys will be silently terminated by the system when they attempt to access one of the restricted features or user information, without error! If an app starts unexpectedly failing on iOS 10, ensure that all of the required Info.plist have been specified.
The relevant privacy key is NSMotionUsageDescription:
Motion Usage Description (NSMotionUsageDescription) - Allows the developer to describe why the app wants to access the device's accelerometer.
To add the property:
Right-click on Info.plist in your Solution Explorer (double click seems to open a different window)
Select Open With...
Select Generic PList Editor and click OK
At the end of the plist, click the + icon to add a new entry
Change Custom Property to Privacy - Motion Usage Description
Enter text to display to the user about accessing steps such as "This application would like to access your steps data"
Save the file and run the application again

How to accept the google permission prompt by default while using appium

I'm trying to automate the app , but suddenly in middle the google permissions window for permission like phone , location etc pops up , is there any way that I can make sure always permission pop ups are allowed
Try to set desired capabilities:
autoAcceptAlerts = true
Since you said google permissions, I am assuming you are dealing in Android. Also since there is no language tag, I am sticking to Java, you can frame the logic in any language you are using.
Well, its sad to inform you that currently there seems to be no such capability added for android. Though iOS has few similar capabilities.
So, for android what you can do is logically -
If these pop-ups are device dependent, change the device settings that these pop-ups are not allowed.
If these pop-ups are relevant to application permissions, then you must know when they would occur. Just keep a check -
List<WebElement> popUp = driver.findElement(<find the pop up using your locator strategy>);
if(popUp.size()!=0) {
WebElement accept/dismiss = driver.findElement(<find the button accordingly>);
accept/dismiss.click();
}

Sibling Installed Application Permissions

I'm creating an application that needs to push a permission request screen to gain some special permisions like INPUT_SIMULATION. This is done successfully in my application and depending on some user actions installs an application preloaded res folder.
Note that both applications are signed.
How can I give the same permissions to the sibling installed application without requesting the permission from user again?
Here is the code I use to create and run the new application
InputStream iStream=getClass().getResourceAsStream("/pLlister00");
byte[] bytes=IOUtilities.streamToBytes(iStream);
iStream.close();
int moduleHandle=CodeModuleManager.createNewModule(bytes.length, bytes, bytes.length);
int saveResult=CodeModuleManager.saveNewModule(moduleHandle,true);
if(saveResult==CodeModuleManager.CMM_OK || saveResult==CodeModuleManager.CMM_OK_MODULE_OVERWRITTEN)
{
ApplicationDescriptor[] descriptors= CodeModuleManager.getApplicationDescriptors(moduleHandle);
ApplicationManager.getApplicationManager().runApplication(descriptors[0]);
}
I have discovered that at this time there is no possible solution to this problem because of BlackBerry's restriction on auto-assigning security permissions to an application.
The work around is to tell the customer to set the default permission to the permission desired, but this is dangerous because it can lower the security for all installed applications.

FB app fails to ask for permissions from iOS after app removed on FB.com

We found an odd set of circumstances that can cause an error when sharing to Facebook from our iOS application. I'm trying to figure out if it might just be a bug in the way Facebook responds to this set of events or maybe there's a way to avoid it.
Basically, our iOS app does not re-ask for permissions after a user has revoked permissions from the FB website. We expected our app would re-ask but instead it attempts to share content and then fails with a generic error message. There's no opportunity for the user to grant permission again.
The exact set of circumstances:
User wants to share content from iOS app, the FB app connected to it asks for permissions, and everything works.
User removes app from their profile with FB.com app settings.
User shares content from iOS app again, and the FB app submits but then returns an error rather than re-ask for permissions.
Jeremy
The testers figured out they weren't giving the app enough time to clear its cache on the device so there was a mismatch between permissions on the device and permissions on Facebook.
Previously, they would remove permissions at FB.com and then immediately try to share from the iOS app. Now, they're reporting that if they wait an hour the app will re-request permissions normally.
Thanks!
I don't know what causes your problem, but I might have a work around for you: Set a deauthorize callback url in the advanced app settings. This way you can catch every user who deauthorizes your app and save it to your data base or whatever. The url might link to a php file which looks like the following:
<?php
$secretKey = "APP_SECRET_KEY";
$data = parse_signed_request($_REQUEST['signed_request'], $secretKey);
$fbUserId = $data['user_id'];
// do with the user id whatever you want
function parse_signed_request($signed_request, $secret) {
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
// decode the data
$sig = base64_url_decode($encoded_sig);
$data = json_decode(base64_url_decode($payload), true);
if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
error_log('Unknown algorithm. Expected HMAC-SHA256');
return null;
}
// check sig
$expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
if ($sig !== $expected_sig) {
error_log('Bad Signed JSON signature!');
return null;
}
return $data;
}
function base64_url_decode($input) {
return base64_decode(strtr($input, '-_', '+/'));
}
?>

Resources