App details:
I am writing an app that requires the user to have a device password set. The company distributes blackberry devices to its associates who will then use them to report on sales etc. The company wants to make sure that the device password is set so that the confidential information can not be easily accessed by anyone if they steal the phone. The app must not work if the password is not set, which is easy enough.
The problem:
The company wants the a message to come up saying "Please set a device password" and then direct the user to the device to the options menu to show them where to set their device password. Doing this seems troublesome
What I have tried so far:
I have looked into the ApplicationManager object, which allows you to bring an application to the foreground. However when I use the following code to see what applications are available:
ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor descriptors[] = manager.getVisibleApplications();
for(int i=0;i<descriptors.length;i++)
{
String applicationName= descriptors[i].getName();
System.out.println("applicationName");
}
The only visible applications are stuff like Phone, Messages, Blackberry Messages, Home Screen etc, but the options application is not present, which leads me to believe its not accessable from here. (If I'm wrong please let me know)
I have also taken a look at the Invoke.invokeApplication(appType, args) method, however the API does not have an appType constant for the options, or settings etc. The API specifies only the following types and I cannot find the one I need:
APP_TYPE_ADDRESSBOOK
APP_TYPE_BLUETOOTH_CONFIG
APP_TYPE_CALCULATOR
APP_TYPE_CALENDAR
APP_TYPE_CAMERA
APP_TYPE_MAPS
APP_TYPE_MEMOPAD
APP_TYPE_MESSAGES
APP_TYPE_PHONE
APP_TYPE_SEARCH
APP_TYPE_TASKS
I have scanned the API docs and I cannot find anything that looks right. Ive searched for Device and Options and Settings but none of the hits are relevant.
If anyone knows what to do then let me know.
Unfortunately there's no standard API to invoke this screen programmatically. But there's a workaround. Use EventInjector to inject a sequence of keyboard events to open Options screen.
This way is not an elegant one, but I think it is the only workaround in this case.
UPDATE:
I would implement the following approach. Upon application startup I would check, whether device is password protected via DeviceInfo.isPasswordEnabled().
If device is not password protected I would display message: Device is not password protected. Please set password for your device in the device Options. And launch the application again.
I understand, this way is not elegant, but it is reliable and provides full information to the customers, how to use this application properly.
Ok so as it turns out you can run internal apps using the ApplicationManager, so I launched the Options app using the following code:
ApplicationManager.getApplicationManager().launch("net_rim_bb_options_app");
However this only launches the Options app, and does not navigate the user to the Security section.
The following blurb from this page helped me understand what this method really does:
Starting
A BlackBerry application can be started in a number of ways:
by the system automatically on device startup
by another application
by the system at a scheduled time
Regardless of how an application is started, the Application Manager is responsible for starting the process the application will run within.
The ApplicationManager class enables applications to interact with the Application Manager to perform tasks, including:
run an application immediately or at a scheduled time
interact with processes, including retrieving the IDs for foreground applications
post global events to the system
Entry points
The Application Manager starts an application by getting a new process and spawning a thread within that process to call one of the entry points of the application. For many applications, the main() method of its application class is the single entry point that is called. But you can configure more than one entry point for an application.
Using more than one entry point lets you create different ways for a user to start an application. For example, if your application allows users to create a new document, you might like to provide users with two icons that they can click to start the application. Users could click one icon to open the application to its home screen and the other icon to open the application to the screen required to create a new document.
Summary
So basically this method just runs the main method of the app, and supplies the arguments in the main method. It is my suspicion that the main method of the Options app does not allow for you to supply the page you want to open up on as an argument in the main method.
There is no documentation (as far as I can tell) on what arguments the options app takes, so short of guessing how it can be used, it seems that directing the user here and giving them some instructions on how to navigate further is my only option
u_u
Related
I'm trying to build a report-building tool (which has a UI written in JavaFX) that has the following features:
When the system (re-)boots, it should auto-start in the background (without showing the UI)
It should have an icon in the system tray
The UI should only show when the user clicks on the system tray icon
A report should be generated either once a day/week/month, at a specific time, automatically
It should "snooze/sleep" in the interim period and use minimal resources while it awaits the next trigger time
It should show a toast pop-up / Windows notification / whatever when a new report has been generated
(The bold ones are the real problems, the italics are maybe solvable--given some resources I found--and the un-formatted one I have a work-around for, namely to place it on in the Startup folder in the AppData folder of the users' machine.)
But the clincher is the following: due to my company's policies, I'm NOT allowed to build register it as a Windows service. Also, converting it into a web service, placing it on a server, and using Control-M (or a cron expression) are also off the table. (That's a long story for another day.) I'm not sure how to implement it and I've been stuck on this for a bit.
I've taken a look at Quartz, this other StackOverflow question, and some other resources on how to run the Java app in the background, but most resources tell me to add it as a Windows service and I keep hitting a brick wall. Also, I don't know how much of an effect the application would have on the users' machines if I ran the application in the background with the solutions mentioned in the other StackOverflow answer. I need to have a minimal processing footprint in the interim period.
I'm also unsure of how to package the application as an EXE. For now, I'm going to turn it into an executable JAR. (Any help on this would also be welcome.)
I'm open to any suggestions and ideas and even other resources to look at for further reading. Anything to help me out here is welcome.
I am developing a windows based java application, One of the requirements for this application is, when this application is installed on other machines, it should open automatically at specified time and user has to select some option on the application, If the user didn't choose the options and close/minimize the application, the application should pop-up again after some time.
Please let me know how do I achieve the above functionality.
First of all, because of security reasons windows services are prevented from interaction with users via Gui - one should make significant efforts to show window from service process. You described process that unlikely may be called windows service, rather it should be scheduled. Some kind of Windows port of cron will help you. For instance, nnCron. It can in particular display, hide, close, kill, minimize, maximize and hide specified windows to system tray. Just in case, to fully answer your question - turning process (that has no GUI and was not created as service) into windows service is easy with help of srvany. Srvany.exe allows any Windows application to run as a service.
I've been pondering over this problem most the afternoon and haven't yet found the most ideal solution so thought I would see what others think..
There is a legacy Win16 application that has to be modified (with the least effort) in order to communicate with a web based application.
The idea is such that in the Win16 app, the user will want to look up a specific code, so they'll click a button which will then launch the browser and allow them to navigate a specific set of pages until they find the result they desire, then they have the option of either pressing Select or Cancel.
Pressing Select should pass back a small string back to the app (around 10 characters) and close the browser. Cancel will likewise send a Cancel message back to the app and again close the browser window.
I can't see many choices available in implementation as the Win16 app is not able to call webservices, so I'm looking at using the clipboard, however that is not without problems.
I hope there's some other alternative I haven't thought of,
As always - all advice appreciated.
Thanks,
I have blackberry app (java). My app stores some informations in files (file:///store/home/user/app_name/). When user removes app, these files don't delete.
I want to delete files when app is removed by user.
What is solution?
Don't store files this way - use Persistable for your app data instead: http://docs.blackberry.com/en/developers/deliverables/17952/Storing_objects_persistently_1219782_11.jsp
There are two "standard" ways to uninstall an application. The first, via Options - Applications menu. And the second, via javaloader -erase -f command.
Theoretically you can intercept the uninstall event for the first way (when you use "Options - Applications" menu), but you need additional application that receives this event and does the cleanup action.
To intercept and recognize an unknown event I do the following.
I write a simple BlackBerry app, that implements and uses GlobalEventListener and runs in background, and prints every intercepted global event guid to the system output and/or log with timestamps.
Now, uninstall your app from Options menu and inspect logged global event guids. After that install/uninstall another applications. And then inspect log/system output window to find out which events are related to uninstall action.
It does not guarantee 100% result, but at least you will get fun with coding, logging and exploring.
We are developing an application which accesses an API exposed over some embedded system. This API internally validates the user to provide the access to the embedded system. To validate the call, it opens a dialog box and asks for username and password. This dialog box is essentially a Java applet opened in applet viewer.
We want to automate this whole process by building small exe or by doing the same in tomcat server. To do the same, we need get the object of the dialog box and fill the credentials. How can we achieve this. There must be some way to automate the testing of applets which can be used to do the above task.
Thanks for helping. It will be great if someone can provide a code snippet or link for the same :)
Reason why I want to have this kind of system:
We need to build an application which gets the memory status of PLC device. This device is connected with heavy machines and has its own programming language via digital networks. To get the memory map, there are APIs exposed in java which communicates with assembly language. We use these APIs to get the memory status of various memory variables from PLC device. On the basis of the memory status we raise an alert by sending an email or SMS. When we try to access the memory area of this device for the very first time, it pops up an authorization dialog box which asks for username and password of PLC device.
Hence, to automate the memory monitoring system which can send the alerts, we have to fill the authorization dialog box through java program or some of the other way. When I access memory of PLC from java console program we need this authorization dialog to be filled by itself without any manual intervention.
So, How can we get an object of this dialog box?
I hope scenario is clear. We don't need any framework to build which can automate the applet UI. We just need for specific dialog box. Please help!!
You can do with with any number of Java GUI functional testing tools. Here's a good list, looks like FEST or Jemmy might be a good approach:
Automated tests for Java Swing GUIs
It looks like they all build on top of java.awt.Robot so you can look at that if you want to roll your own.
If this does not work you may have to go to a native GUI testing framework. Some good options are listed here for Windows:
https://stackoverflow.com/questions/120359/tools-for-automated-gui-testing-on-windows
http://sikuli.org/ pretty good.