When i launch the application, my app will search the database file from the following path (store/home/user/sample.db). If my blackberry device connects to a computer, and at that time if i launch my application, it's not able to find the path and read the database (not able to access the path).
In this above situation, i want to check it if the media storage is accessible or not; if not i need to display the warning message. Is there is any blackberry API avialable to check this scenario?
Note:
I know that we can change the media storage option, in the device -> options -> device-> storage, but i don't want to change this setting.
If you are only looking to detect if the device is connected via the USB cable, then I think you can get the USB connection state using
USBPort.getConnectionState()
and you should check the state for
SystemListener2.USB_STATE_CABLE_DISCONNECTED
In your case, I think you need to check to see if the root 'store' is available, which you can do using code like the following:
boolean avail = false;
Enumeration drives = FileSystemRegistry.listRoots();
while(drives.hasMoreElements()) {
String root = (String) drives.nextElement();
System.out.print("Supported File System Root = " + root);
if(root.equalsIgnoreCase("store/")) {
avail = true;
break;
}
}
You need to verify, when you connect your device to your computer, select the charge only option, otherwise the computer mounts the media storage, and is inaccessible to the device.
Related
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();
}
I am working on an application that has a secure container for files. From the security needs we have to prohibit document extension for host applications that are in a black list. Are there any opportunities to identify bundle/name of the host app.
I have tried to get access for NSXPCConnection * _auxiliaryConnection; in NSExtensionContext but it is nil. (https://github.com/CPDigitalDarkroom/iOS9-SpringBoard-Headers/blob/master/usr/lib/libextension.dylib/NSExtensionContext.h)
Talking about document extension provider I mean (https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html)
Thanks!
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.
I'm having a problem with getting the tutorial to work on the device
it works fine in the simulator, but when I try to run it on the device it doesn't work.
I put some logs and it seems to come from the login function
===JASONROGERS292C 2480 supAdmin s3pAdmin
[0.0] TAC:TAI.handleRegRsp : ALREADY_REGISTERED
[0.0] TAC:TAI.handleRegRsp : (ALREADY_REGISTERED), registered entry found:{{APN=,id=2,state=CLOSED,waf=WAF[0.0] _3GPP,keepAlive=300,IP=0.0.0.0,dnsSrv=0.0.0.0}}
[0.0] [TMM.TunnelAllocator]:runNotReadyListeners: registered listeners found
[0.0] TAC:TAI.handleListenerDeRegRsp: not existent tunnel in TAC, tid=2
[0.0] SIM cache not loaded
has anybody got an idea what I forgot to do when running the code on a device?
Cheers
Jason
edit:
a couple of links towards what I'm doing (I can post all the code people want but its the standard generated code form SUP, which mean a lot of code lol)
The tutorial
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01214.0200/doc/html/title.html
the zip to the already done tutorial :
http://www.sdn.sap.com/irj/bpx/index?rid=/webcontent/uuid/40ea4956-b95c-2e10-11b3-e68c73b2280e
Solution:
I was missing a couple of things:
1) Specify that the app should use Wifi
SUP101DB.getSynchronizationProfile().setString("transport", "WIFI");
2) Check that the DNS: in my case the server was local to my windows (through parallels) so I had to specify the ip and not the namespace
getSynchronizationProfile().setServerName("10.50.30.108");//"JASONSERVER");
I downloaded the SUP 101 - BlackBerry Project and checked the sources.
It does not contain networking code in the form a usual BB app would do.
However I see the SUP101.SUP101DB class has the following method:
private static String getSyncTransportSuffix() {
com.sybase.persistence.ConnectionProfile syncProfile =
getSynchronizationProfile();
return com.sybase.afx.util.NetworkUtil.getTransportUrlSuffix(syncProfile);
}
So the code uses com.sybase.afx.util.NetworkUtil to get url suffix. By appending such suffix to a url we say to the underlaying BB API what network transport to use. Unfortunatelly sources do not contain com.sybase.afx.util.NetworkUtil to look how exactly it works.
I should say that even with native Java BB development detecting a proper network transport may turn to be a very tricky part. OS 5+ provides a new networking API that is much better, but for the older OS it is hard. This SUP project is built with BlackBerry JRE 4.6.1, so it can not use new OS 5+ networking API. Who knows maybe SUP simply fails to detect proper network transport?
Any way, just a few ideas to try:
check for APN settings on the device, sometimes they have to be populated in order to use Direct TCP transport (it depends on wireless provider requirements). APN name/pass are wireless provider specific. Usually googling allows to find proper APN settings for a provider.
if your device has WiFi try enabling it. SUP should be smart enough to prefer WiFi if available. In this case I assume networking should have no issues.
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);