System.getProperty

I'm trying to access the SD card on the Simulator.

I first 'change' SD card via the Simulation menu and specify a path name, that I have set up to be identical to the structure of the directory of the SD card.

Then, something I just found out, is that I have to get the name of the SD card.

System.getProperty tried to get the name of the root directory, and I got the following results.

The key string result

filecon.dir.MemoryCard null

filecon.dir.MemoryCard.Name null

Why do I get null for the name of the name of the SD card?

How to open a file on an SD card on the Simulator is - a. Is there anything else I need to put in place on the Simulator in addition to change SD card.

.. .where is this result telling me that the way to access the Blackberry directory on the SD card is to use the following:

file:///BlackBerry/

that is the SD card has no name... null?

Thank you

-Donald

I solved this myself (at least this part :-)

OK, for those of you who want to know how to open your media card correctly (at least in the storm).

First, make a call to System.getProperty ("fileconn.dir.memorycard");

This returns the string "file:///SDCard/".

Note that you are not guaranteed that the file system of the media card will always be SD card, so you should always call System.getProperty beforehand.

Then, if you use the Simulator, you must select the simulate change... SD card menu. This opens a small window allowing you to select different directories (by default is set to None, which means the media card is disconnected). You can click new folder to set the directory that emulates the directory root of the press card. You can enter several directories and it will remember them so you can switch from one to the other. The entry selected (highlighted) is used, so if you select none, it generates an event to remove media card.

You must also set the it strategy using strategy-simulation game IT... menu.

Under the tab control application, you must assign to allow local connections and all the other features that you will use. Similarly, the policy of COMPUTER you must select allow local connections and click on him-> the button to add to the list of policies. Also you must click on the set after that to define the it strategy.

OK, now you can open the connection to the file.

-Donald

Tags: BlackBerry Developers

Similar Questions

  • Typo in document System.getProperty

    http://supportforums.BlackBerry.com/T5/Java-development/supported-system-GetProperty-keys/Ta-p/44521...

    fileconn.dir.MemoryCard.Video must bes fileconn.dir.memorycard.video instead. The former will throw an exception.

    Thanks for the find! I will get this update soon.

    See you soon,.

  • Problems capturing pictures about OS6 - East System.getProperty ("video.snapshot.encodings"); valid?

    Hello

    I hope someone can help with this query.

    I use the code that is very similar to the sample application camerademo to take a photo using the camera. It works properly on devices running OS5. However, on devices running OS6 photo is just an image of white/black.

    I think I followed the problem until the encoding string passed to getSnapshot(). When I switch which must be a valid encoding string (based on the output of System.getProperty ("video.snapshot.encodings")) the captured image is a black screen. However, when I pass null to getSnapshot() it works correctly. I want to avoid using null as the captured image is much more that I need and for reasons of effectiveness, I would like to avoid having to reduce its size after the capture of the photo.

    I tested this on the 9780 Simulator. The corresponding code is included below for reference.

    Thanks in advance!

    /*
     * CameraDemo.java
     *
     * Copyright © 1998-2008 Research In Motion Ltd.
     *
     * Note: For the sake of simplicity, this sample application may not leverage
     * resource bundles and resource strings.  However, it is STRONGLY recommended
     * that application developers make use of the localization features available
     * within the BlackBerry development platform to ensure a seamless application
     * experience across a variety of languages and geographies.  For more information
     * on localizing your application, please refer to the BlackBerry Java Development
     * Environment Development Guide associated with this release.
     */
    
    package com.rim.samples.device.camerademo;
    
    import java.util.Vector;
    
    import javax.microedition.amms.control.camera.CameraControl;
    import javax.microedition.media.Manager;
    import javax.microedition.media.Player;
    import javax.microedition.media.control.VideoControl;
    
    import net.rim.device.api.system.Characters;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Keypad;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.RichTextField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.util.StringUtilities;
    
    /**
     * A sample application used to demonstrate the VideoControl.getSnapshot()
     * method. Creates a custom camera which can take snapshots from the
     * Blackberry's camera.
     */
    final class CameraDemo extends UiApplication
    {
        /** Entry point for this application. */
        public static void main(String[] args)
        {
            CameraDemo demo = new CameraDemo();
            demo.enterEventDispatcher();
        }
    
        /** Constructor. */
        private CameraDemo()
        {
            CameraScreen screen = new CameraScreen();
            pushScreen( screen );
        }
    }
    
    /**
     * A UI screen to display the camera display and buttons.
     */
    final class CameraScreen extends MainScreen
    {
        /** The camera's video controller. */
        private VideoControl _videoControl;
    
        /** The field containing the feed from the camera. */
        private Field _videoField;
    
        private Player player;
    
        /** An array of valid snapshot encodings. */
        private EncodingProperties[] _encodings;
    
        /**
         * Constructor. Initializes the camera and creates the UI.
         */
        public CameraScreen()
        {
            //Set the title of the screen.
            //setTitle( new LabelField( "Camera Demo" , LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH ) );
    
            //Initialize the camera object and video field.
            initializeCamera();
    
            //Initialize the list of possible encodings.
            initializeEncodingList();
    
            //If the field was constructed successfully, create the UI.
            if(_videoField != null)
            {
                createUI();
            }
            //If not, display an error message to the user.
            else
            {
                add( new RichTextField( "Error connecting to camera." ) );
            }
    
        }
    
        /**
         * Adds the VideoField and the "Take Photo" button to the screen.
         */
        private void createUI()
        {
            //Add the video field to the screen.
            add(_videoField);
    
        }
    
        /**
         * Initializes the Player, VideoControl and VideoField.
         */
        private void initializeCamera()
        {
            try
            {
                //Create a player for the Blackberry's camera.
               player = Manager.createPlayer( "capture://video" );
    
                //Set the player to the REALIZED state (see Player docs.)
                player.realize();
    
                //Grab the video control and set it to the current display.
                _videoControl = (VideoControl)player.getControl( "VideoControl" );
    
                if (_videoControl != null)
                {
                    //Create the video field as a GUI primitive (as opposed to a
                    //direct video, which can only be used on platforms with
                    //LCDUI support.)
                    _videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
                    //Display the video control
                    _videoControl.setDisplayFullScreen(true);
                    _videoControl.setVisible(true);
                }
    
                //Set the player to the STARTED state (see Player docs.)
                player.start();
    
            }
            catch(Exception e)
            {
                Dialog.alert( "ERROR " + e.getClass() + ":  " + e.getMessage() );
            }
        }
    
        /**
         * Create a screen used to display a snapshot.
         * @param raw A byte array representing an image.
         */
        private void createImageScreen( byte[] raw )
        {
            //Initialize the screen.
            ImageScreen imageScreen = new ImageScreen( raw );
    
            //Push this screen to display it to the user.
            UiApplication.getUiApplication().pushScreen( imageScreen );
        }
    
        /**
         * Handle trackball click events.
         * @see net.rim.device.api.ui.Screen#invokeAction(int)
         */
        protected boolean invokeAction(int action)
        {
            boolean handled = super.invokeAction(action); 
    
            if(!handled)
            {
                switch(action)
                {
                    case ACTION_INVOKE: // Trackball click.
                    {
                    try
                    {
                        //A null encoding indicates that the camera should
                        //use the default snapshot encoding.
                        String encoding = null;
    
                        // All the below result in a black screen being captured on OS6 devices
                        // encoding = "encoding=jpeg&width=1024&height=768";
                        // encoding = "encoding=jpeg&width=1024&height=768&quality=superfine";
                        // encoding = _encodings[1].getFullEncoding();
                        // Null works but the image captured is large (~1MB)
                        encoding = null;
    
                        //Retrieve the raw image from the VideoControl and
                        //create a screen to display the image to the user.
                        createImageScreen(_videoControl.getSnapshot(  encoding ) );//null works
                    }
                    catch(final Throwable e)
                    {
                        UiApplication.getUiApplication().invokeLater(new Runnable()
                        {
                            public void run()
                            {
                                Dialog.alert( "ERROR " + e.getClass() + ":  " + e.getMessage() );
                            }
                        });
                    }
    
                        return true;
                    }
                }
            }
            return handled;
        }
    
        /**
         * Prevent the save dialog from being displayed.
         * @see net.rim.device.api.ui.container.MainScreen#onSavePrompt()
         */
        public boolean onSavePrompt()
        {
            return true;
        }
    
        /**
         * Initialize the list of encodings.
         */
        private void initializeEncodingList()
        {
            try
            {
                //Retrieve the list of valid encodings.
                String encodingString = System.getProperty("video.snapshot.encodings");
    
                //Extract the properties as an array of words.
                String[] properties = StringUtilities.stringToKeywords(encodingString);
    
                //The list of encodings;
                Vector encodingList = new Vector();
    
                //Strings representing the four properties of an encoding as
                //returned by System.getProperty().
                String encoding = "encoding";
                String width = "width";
                String height = "height";
    
                EncodingProperties temp = null;
    
                for(int i = 0; i < properties.length ; ++i)
                {
                    if( properties[i].equals(encoding))
                    {
                        if(temp != null && temp.isComplete())
                        {
                            //Add a new encoding to the list if it has been
                            //properly set.
                            encodingList.addElement( temp );
                        }
                        temp = new EncodingProperties();
    
                        //Set the new encoding's format.
                        ++i;
                        temp.setFormat(properties[i]);
                    }
                    else if( properties[i].equals(width))
                    {
                        //Set the new encoding's width.
                        ++i;
                        temp.setWidth(properties[i]);
                    }
                    else if( properties[i].equals(height))
                    {
                        //Set the new encoding's height.
                        ++i;
                        temp.setHeight(properties[i]);
                    }
                }
    
                //If there is a leftover complete encoding, add it.
                if(temp != null && temp.isComplete())
                {
                    encodingList.addElement( temp );
                }
    
                //Convert the Vector to an array for later use.
                _encodings = new EncodingProperties[ encodingList.size() ];
                encodingList.copyInto((Object[])_encodings);
            }
            catch (Exception e)
            {
                //Something is wrong, indicate that there are no encoding options.
                _encodings = null;
            }
        }
        protected  boolean keyDown(int keycode,
                               int time) {
            System.out.println("Input" + keycode + "/" + Keypad.key(keycode) + " C1 = " + Keypad.KEY_CONVENIENCE_1 +  " C2 = " + Keypad.KEY_CONVENIENCE_2);
            if ( Keypad.key(keycode) == Keypad.KEY_CONVENIENCE_1 ) {
                return true;
            }
            return super.keyDown(keycode, time);
        }
    
            protected  boolean keyChar(char c, int status, int time) {
                System.out.println("Input" + c + ":" + Keypad.getKeyCode(c, status));
                switch (c) {
                    case Characters.ESCAPE:
                        this.close();
                        return true;
                    default:
                        return super.keyChar(c, status, time);
                }
    
            }
    }
    

    Thanks for getting back to me.

    It turns out that it was only a problem on the Simulator. I managed to get my hands on a real device 9780 and the code works fine on it.

  • System.getProperty returns NULL on Simulator

    The following call:

    System.getProperty("video.snapshot.encodings")
    

    Returns a null value.

    I tried using the default Simulator of the component package 4.5.0_4.5.0.16.

    This key is available in 4.7 +. I don't know what you're trying to do, but you should know that there is no way to adjust the front camera of 4.6.

  • Java 7 u45 System.getProperty returns null

    After the upgrade to u45, our web launch application has stopped working. He failed System.getProperty ("myproperty").

    "myproperty" is defined as an

    < resources >

    < j2se version = "+ 1.6" initial-heap-size = "64 m" max-heap-size = "256 m" / >

    < jar href = "nms_wsclient.jar" Download = hand "impatient" = "true" / > "

    < href = tΘlΘchargement jar "commons - httpclient.jar" = "forward" / >

    < href = tΘlΘchargement jar "commons - codec.jar" = "forward" / >

    < href = tΘlΘchargement jar "commons - logging.jar" = "forward" / >

    < jar href = "log4j.jar" Download = "forward" / > "

    "< property name ="myproperty"" value = "http://138.120.128.94:8085 /" / > ""

    < / resource >

    with old java version, System.getProperty ("myproperty") works very well to return the value, but with u45 it returns null.

    Does anyone have the same problem? no idea how to fix or work around it?

    Thank you

    Zhongyao

    7u45 made a change that is not documented in the release notes. You must precede the properties with jnlp.myproperty in your JNLP file, unless your jnlp file is signed.

    But like me, since you can have different values in multiple deployments, signing the JNLP is impossible.

    I tried to submit a bug on this issue report, but their bug report process works as well as 7u45...

  • Can not read the Oracle JVM system property unless the class is reloaded

    I want to be able to read system properties set of DBMS_JAVA .set_property of a java stored procedure. To do this, I have this simple code:

    public static String getEnvironmentVar(String propertyName) {
            return System.getProperty(propertyName);
    }
    

    When I run the present on the database, java stored procedure does not seem to load the property just has DBMS_JAVA .set_property:

    declare 
         s      varchar2(100);
    begin
         s := dbms_java.set_property('test_prop', 'test_val');
         s := getEnvironmentVar('test_prop');  -- This is my java stored proc
         dbms_output.put_line(s);
    end;
    

    However, when I reload the class in Oracle (with loadjava); the property is read correctly. Am I missing something?

    Thank you.

    If you try the declare in a new session of RDBMS, I think you'll find that it works.  Or insert the line

    s: = dbms_java.endsession;

    between the dbms_java.set_property and the getEnvironmentVar call.  When dbms_java.set_property is called, it creates a value for a property that is used only for subsequent initializations of the java VM for this session of RDBMS.  It does not affect the java VM that has already been initialized in the session, as appropriate.  If java has not been used before that in the session underway, then the virtual machine will be initialized when the getEnvironmentVar call is made and the value established earlier by dbms_java.set_property discussed.  But if java had already been used in the session, such as would happen if you had previously created or solved the class containing the method getEnvironmentVar of the session, then the value set by dbms_java.set_property is not visible (unless and until that something (like dbms_java.endsession, System.exit or an unrecoverable error) occurs to put an end to the existing java VM without end of the RDBMS session).

  • How to set up a system property

    Hello world

    Does anyone know how to set up a system console for WebLogic 11 g property?

    I´d as set up a property via the web console, then get this property in my java code. Something like this:

    System.getProperty ("foo");

    Is this possible?

    Thank you

    Fernando

    Hi Fernando,

    Please see the link which tells us how we can define the JAVA_OPTIONS the administration Console...
    http://WebLogic-wonders.com/WebLogic/2010/03/26/nodemanager-based-managedservers-setting-mem_args/
    The link above demonstrate that how we define * "-the system Duser.dir property = E: / MyDirectory" *...

    Now you can set your own JAVA_OPTION as follows:

    -Dfoo = MyFooValue

    After setting above propertu in AdminConsole MEM ARGS, you must restart the server. Then, you can use the following code:

    String result = System.getProperty ("foo");

    .
    .
    Thank you
    Jay SenSharma

  • Problem call System.loadLibrary () in JRockit JVM for Solaris (Solaris OS) Vs

    Hello

    I try to transfer my code running under Sun JDK 6 in Jrockit (R28).
    However, I am facing a problem of loading a library ('so') under JRockit which works very well under the Sun JVM.
    The LD_LIBRARY_PATH setting is identical for the two JAVA VMs.

    I wrote a class simpel, loading the library (in a file called libDiskCapacityUnix.so, located in/usr/mms/common/lib) just to test this device under two virtual machines Java is the code in the class:

    public class MyClass {}

    Public Shared Sub main (String [] args) {}
    Path String is System.getProperty ("java.library.path");.
    System.out.println ("Java.Library.Path =" + path);
    System.loadLibrary ("DiskCapacityUnix");
    System.out.println ("loading library DiskCapacityUnix succeeded");
    }
    }

    Release of JRockit:

    mms10: / var/tmp [113] /jrrt-4.0.0-1.6.0/bin/java MyClass
    Java.Library.Path=/jrrt-4.0.0-1.6.0/jre/lib/sparcv9/JRockit:/jrrt-4.0.0-1.6.0/jre/lib/sparcv9:/jrrt-4.0.0-1.6.0/JRE/... /lib/sparcv9:/usr/lib/LWP:.:/ usr/mms/common/lib:/usr/cti/lib:/opt/oracle/product/11.2.0.1/instantclient_11_2:/opt/oracle/product/11.2.0.1/instantclient_11_2/lib32:/opt/oracle/product/11.2.0.1/instantclient_11_2/lib:/usr/local/lib:/usr/local/ssl/lib:/usr/lib:/jrrt-4.0.0-1.6.0//jre/lib/sparcv9:/jrrt-4.0.0-1.6.0//jre/lib/sparcv9/native_threads:/usr/local/mms/usr/local/lib:/usr/sfw/lib::/usr/lib
    Exception in thread "Main Thread" java.lang.UnsatisfiedLinkError: no DiskCapacityUnix in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1689)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1029)
    at MyClass.main (MyClass.java:7)


    Sun's JAVA virtual machine output:

    mms10: / var/tmp [123] / usr/mms/java/bin/java MyClass
    Java.Library.Path=/usr/MMS/Java/JRE/lib/sparc/Server:/usr/MMS/Java/JRE/lib/sparc:/usr/MMS/Java/JRE/... /lib/sparc:/usr/lib/LWP:.:/ usr/mms/common/lib:/usr/cti/lib:/opt/oracle/product/11.2.0.1/instantclient_11_2:/opt/oracle/product/11.2.0.1/instantclient_11_2/lib32:/opt/oracle/product/11.2.0.1/instantclient_11_2/lib:/usr/local/lib:/usr/local/ssl/lib:/usr/lib:/jrrt-4.0.0-1.6.0//jre/lib/sparcv9:/jrrt-4.0.0-1.6.0//jre/lib/sparcv9/native_threads:/usr/local/mms/usr/local/lib:/usr/sfw/lib:.:/ usr/jdk/packages/lib/sparc: / lib: / usr/lib
    Loading library DiskCapacityUnix succeeded

    I'm guessing that your library is a 32-bit library? JRockit on sparc 64-bit only and cannot load 32-bit libraries.

    / Staffan

  • Migrating from JBoss to WebLogic 10.3: how to set the system property?

    Hello
    I am migrating from JBoss to WebLogic, and I need to define a global property.

    What I need to do, is to link my path of the properties file for a global property accessible to all applications deployed on the server, in order to find the path of my applications (EJB 2.1) and access the properties without cutting the path of the properties file in the code.

    In jboss, I used the file "properties - service.xml", in which I can set the key/value pairs, and the key will be published to the server and available programmatically as a property system through the call "System.getProperty ().

    How can I do the same in weblogic 10.3?

    Thank you!

    Yes

    In both options... .reading the code in the file property will be the same.

    Thank you
    Jay SenSharma

  • Examples of code to create the connection of BWS

    Hi I started using BWS (Blackberry Web Services) recently after the use of BAA (Blackberry Administration API) for some time. I would get a tutorial or sample code showing the initialization of the connection to the BWS and then use it to call the getUsersDetail method. I have the below code is missing the connection of BWS.

    import java.util.List;
    
    import com.rim.ws.enterprise.admin.*;
    public class BWSTest {
    
        public static String locale = "en_US";
        public static void main(String[] args){
    
            RequestMetadata requestMetadata = new RequestMetadata();
            requestMetadata.setLocale(locale);
            GetUsersDetailRequest userRequest = new GetUsersDetailRequest();
            userRequest.setMetadata(requestMetadata);
            userRequest.setLoadDevices(true);
            userRequest.setLoadAccounts(true);
            userRequest.setLoadITPolicies(true);
            userRequest.setLoadSWConfigs(true);
    //      List allUsers=userRequest.getUsers(); this method reflects users added as part of the request, not resulting from it
            GetUsersDetailResponse response = bws.getUsersDetail(request);
    
            if (response.getReturnStatus().getCode().compareTo("SUCCESS") !=0){
                System.out.println("Error occurred: "+response.getReturnStatus().getMessage() );
            }
    
            for(GetUsersDetailIndividualResponse individualResponse:response.getIndividualResponses()){
                individualResponse.getUserDetail().getDisplayName();
            }
    
        }
    
    }
    

    I found this code on the following link in a zip file:

    BWS Java sample

    import java.net.MalformedURLException;
    import java.net.URL;
    
    import javax.xml.ws.BindingProvider;
    
    import com.rim.ws.enterprise.admin.BWS;
    import com.rim.ws.enterprise.admin.BWSService;
    import com.rim.ws.enterprise.admin.BWSUtil;
    import com.rim.ws.enterprise.admin.BWSUtilService;
    import com.rim.ws.enterprise.admin.GetEncodedUsernameRequest;
    import com.rim.ws.enterprise.admin.GetEncodedUsernameResponse;
    import com.rim.ws.enterprise.admin.GetUsersRequest;
    import com.rim.ws.enterprise.admin.GetUsersResponse;
    import com.rim.ws.enterprise.admin.GetUsersSearchCriteria;
    import com.rim.ws.enterprise.admin.GetUsersSortBy;
    import com.rim.ws.enterprise.admin.RequestMetadata;
    import com.rim.ws.enterprise.admin.User;
    
    /**
     * This simple program finds users on the BlackBerry Administration Server,
     * and displays the existing users in the Console output.
     *
     * @author gbeukeboom
     *
     */
    
    public class TestMain {
    
        public static BWSService _myBWSService;
        public static BWS _bws;
        public static BWSUtilService _myBWSUtilService;
        public static BWSUtil _bwsUtil;
        private static String _locale = "en_US";
        private static String _clientVersion = "5.0.3"; //The version of BAS this application was created for
        private static RequestMetadata _meta = new RequestMetadata();;
    
        private static boolean setup() {
            String strBASURL=System.getProperty("basurl");
            URL serviceUrl = null;
            URL utilServiceUrl=null;
    
            //The Metadata object includes information about this application, it is included with every call
            _meta.setClientVersion(_clientVersion);
            _meta.setOrganizationUid("0"); //Not used currently, set to "0"
            _meta.setLocale(_locale);
    
            try {
                serviceUrl = new URL("https://" + strBASURL + "/enterprise/admin/ws?wsdl");
                utilServiceUrl = new URL("https://" + strBASURL + "/enterprise/admin/util/ws?wsdl");
            } catch (MalformedURLException e) {
                System.err.println("Cannot initialize the wsdl");
                return false;
            }
    
            //Initialize our web service stubs that will be used for all calls
            _myBWSService = new BWSService(serviceUrl);
            _bws = _myBWSService.getBWS();
            _myBWSUtilService = new BWSUtilService(utilServiceUrl);
            _bwsUtil = _myBWSUtilService.getBWSUtil();
    
            String username=System.getProperty("username");
            String password=System.getProperty("password");
    
            GetEncodedUsernameRequest request=new GetEncodedUsernameRequest();
            request.setMetadata(_meta);
            request.setUsername(username);
            request.setDomain(strBASURL);
    
            //The BAS expects the username to be encoded, this call returns the encoded value
            GetEncodedUsernameResponse geurResponse = _bwsUtil.getEncodedUsername(request);
    
            if (geurResponse.getReturnStatus().getCode().compareTo("SUCCESS") != 0){
                System.out.println("Error occurred: " + geurResponse.getReturnStatus().getMessage());
                return false;
            }
    
            String myEncodeUsername = geurResponse.getEncodedUsername();
    
            //Set http basic authentication on the web service
            BindingProvider bp = (BindingProvider)_bws;
            bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, myEncodeUsername);
            bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
    
            return true;
        }
    
        public static void getUsers() {
    
            GetUsersRequest request = new GetUsersRequest();
            request.setMetadata(_meta); //Assign our Metadata to the call
    
            //This criteria object could be used to specify search parameters
            GetUsersSearchCriteria searchCriteria = new GetUsersSearchCriteria();
    
            request.setSearchCriteria(searchCriteria);
            request.setPageSize(500);
    
            GetUsersSortBy sortBy = new GetUsersSortBy();
            sortBy.setEMAILADDRESS(true);
            sortBy.setValue("EMAIL_ADDRESS");
            request.setSortBy(sortBy);
            request.setSortAscending(true);
    
            GetUsersResponse response = _bws.getUsers(request);
    
            //If the result returned from the call is SUCCESS then we loop through all returned users
            //outputting their information to the console.
            if (response.getReturnStatus().getCode().compareTo("SUCCESS") != 0){
                System.out.println("Error occurred: " + response.getReturnStatus().getMessage());
            } else if (response.getUsers() != null) {
                for (User itr: response.getUsers()) {
                    System.out.println("Display name: " + itr.getDisplayName());
                    System.out.println("User ID: " + itr.getUid());
                    for (String emailAddress :itr.getEmailAddresses() ){
                        System.out.println("Email Address: " + emailAddress);
                    }
                    System.out.print("\n");
                }
            }
        }
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            System.out.println("Starting to intiialize credentials...");
            if (!setup()){
                System.out.println("Problem occurred while setting up credentials.");
                System.exit(0);
            }
            System.out.println("Credentials initialized.\n");
            System.out.println("Starting to retrieve users...");
            getUsers();
        }
    
    }
    
  • How to detect if the Android app is the reconditioned Blackberry version?

    My application can be easily repackaged for blackberry devices using its web portal.

    http://developer.BlackBerry.com/Android/documentation/using_the_bb_packager_1873331_11.html

    So, I can turn my .apk file in a .bar file that users can install on their devices BB10.

    My concern now would be to slightly change the user interface or disable certain features (invoicing app, Google Maps, some intentions) about the operating system.

    I should like, for example, to display a button of the card on legit Android devices and remove this button on the port of Blackberry. I also have some preferences related to the widget that have no reason to appear on a device BB10

    You know an ideal way to detect if the app is the one refurbished or the original apk?

    My guess would be to use the Build information, but I'm pretty sure that there is a better way to do this.

    Try:

        public static boolean isBlackBerry() {
            return java.lang.System.getProperty("os.name").equals("qnx");
        }
    
  • How can I add pictures to the gallery and see from BlackBerry Media Center

    I want to add a file to the image to the device file system. then, he discovers the BlackBerry Media Center. I use under folder to add a picture

    System.getProperty ("fileconn.dir.photos");

    This function gives me a way and I write to the file in this folder. But, as I wrote, I have strictly see native BlackBerry support center. What should I do to see this image?

    Thank you

    The BlackBerry Media Center should be able to view all the folders.  You choose the view all the photos option?  This file you write to?  Have you tried a different folder?  What format is the image?  What model of Smartphone BlackBerry and the BlackBerry terminal software version you test on?  You can find this under Options, all on the BlackBerry Smartphone.

  • Image recording is not real but device works perfectly on emulator

    Hi guys, I use the JDE 4.6.1. I would like to keep an image uploaded to the file system and retrieve it later. Something like a caching option. Everything works perfectly on the Simulator, but when I install it on the device, it does not work. Here's the code,

    private StringBuffer Imagedirectory = new StringBuffer(System.getProperty("fileconn.dir.photos"));
    
    FileConnection fc = (FileConnection)Connector.open(Imagedirectory.toString(),Connector.READ_WRITE);
    
                    if(!fc.exists()){
                        Util.getWebData(url, this);
                    }else{            
    
                        byte[] data = getData(fc);
    
                        bitmap = EncodedImage.createEncodedImage(data, 0,
                                data.length);
    
                        if(this.width !=0 && this.height !=0){
                            bitmap = ScaleImageToSize(bitmap, this.width,this.height);
                        }
                        setImage(bitmap);
     }
    

    This is where I get the data of the file

    private byte[] getData(FileConnection file)
        {
            byte[] data = new byte[0];
            try
            {
                 InputStream input = file.openInputStream();
                              //////////
                 int SIZE = 100000;
                 ByteArrayOutputStream byteArrayOutputStream = new
                                    ByteArrayOutputStream();
                 byte[] buffer = new byte[SIZE];
                 while (true)
                 {
                   int bytesRead = input.read( buffer, 0, SIZE );
                   if (bytesRead == -1) break;
                   byteArrayOutputStream.write( buffer, 0, bytesRead );
                 }
                 data = byteArrayOutputStream.toByteArray();
                 byteArrayOutputStream.flush();
                 byteArrayOutputStream.close();
    
            }
            catch(Exception e)
            {
                System.out.println(e.toString());
            }
            return data;
    
        }
    

    This is where I write the image to a file,

    private void writeFile(byte[] data, String fileName)
        {
            FileConnection fconn = null;
            try {
                fconn = (FileConnection) Connector.open(fileName,
                        Connector.READ_WRITE);
            } catch (IOException e) {
                System.out.print("Error opening file");
            }
    
            if (fconn.exists())
                try {
                    fconn.delete();
                } catch (IOException e) {
                    System.out.print("Error deleting file");
                }
                try {
                    fconn.create();
                } catch (IOException e) {
                    System.out.print("Error creating file");
                }
                OutputStream out = null;
    
                try {
                    out = fconn.openOutputStream();
                } catch (IOException e) {
                    System.out.print("Error opening output stream");
                }
    
                try {
                    out.write(data);
                    out.flush();
                } catch (IOException e) {
                    System.out.print("Error writing to output stream");
                }
    
                try {
                    fconn.close();
                } catch (IOException e) {
                    System.out.print("Error closing file");
                }
        }
    

    Help, please.

    Thanks much for the reply.

    I found the problem, the byte array which I was the analysis was not proper, so I created the image first and after that used the information bytes of that to save the image. Here is the solution.

     public void callback(final String data)
        {
            if (data.startsWith("Exception")) return;  
    
            try
            { 
    
                byte[] dataArray = data.getBytes();
                bitmap = EncodedImage.createEncodedImage(dataArray, 0,
                        dataArray.length);
    
                if(this.width !=0 && this.height !=0){
                    bitmap = ScaleImageToSize(bitmap, this.width,this.height);
                }
                setImage(bitmap);           
    
                if(isWriteImage()){
    
                    System.out.println("Before writing the image");
                    writeFile(bitmap.getData(), Imagedirectory.toString());
                    System.out.println(Imagedirectory);
                    System.out.println("Image written - Operation Successful");
                }
    
            }
            catch (final Exception e){
                System.out.println("Image Creation Failed");
            }
        }
    

    The problem was because I was the array of bytes of the string of variable data analysis. No idea why this caused a problem?

  • recover device user agent?

    This may be a bad question but would like advice in the right direction.

    Suppose an application has a built-in browser field. In request HTTP for the browser, the application must add user profile, x-wap-profile agent, accept, accept-charset, etc. in the header. If we want the app to work on different phones, we would like to dynamically detect the user agent of the device profile, x-wap-profile, accept, etc. of the capabilities or properties.  Can use them for the browser field.

    Is there a way to retrieve user profile, x-wap-profile of a device agent?

    Thank you

    Try this one:

    String version = "";
            ApplicationDescriptor[] ad = ApplicationManager.getApplicationManager()
                    .getVisibleApplications();
            for (int i = 0; i < ad.length; i++) {
                if (ad[i].getModuleName().trim().equalsIgnoreCase(
                        "net_rim_bb_ribbon_app")) {
                    version = ad[i].getVersion();
                    break;
                }
            }
    
            return "Blackberry" + DeviceInfo.getDeviceName() + "/" + version
                    + " Profile/" + System.getProperty("microedition.profiles")
                    + " Configuration/"
                    + System.getProperty("microedition.configuration")
                    + " VendorID/" + Branding.getVendorId();
    
  • question how to get/use the line separator

    I'm trying to get the line of the system separator and use it in a text that is getting added to a TextField.

    System.getProperty ("line.separator") returns null.

    What is the correct way to do it?

    Here is a code example:

    String newLine = System.getProperty("line.separator");
    String text =   "First line of text." + newLine +
            "Secon line of text." + newLine +
            "Last line of some more text.";
    
    TextField t  = new TextField(TextField.READONLY);
    t.setText(text);
    

    I tried this with the Simulator and on a Pearl 8100.

    I use JDE plugin for Eclipse 1.0.0.50

    BlackBerry component Pack 4.5.0.14.

    2.9.0.52 - Blackberry 8100 smartphone Simulator

    The device software is 4.5.0.110

    Thank you

    If I understand the question, what right do something like "\n"?

Maybe you are looking for

  • With v 18.0.1 I can't download using amazon s3 organizer

    I use Organizer from amazon s3 to handle large files. Since the upgrade to v 18.0.1 I can't download a file. Same file that I had already downloaded earlier. Same thing on my wife with XP machine. It works OK on my laptop with v 17.0.1.Here is the me

  • DV7-6c95dx: power on password locked

    trying to solve the following - entry administrator OR power on password - machine acquired that I thought he would at least start upwards with recovery media-, it does absolutely NOTHING but beep and after 3 trials gives a code that is -55537566-

  • Card Flash (TCrdMain.exe) keeps crashing on Satellite L30

    (Running Vista Home Basic on a Satellite L30) The utility of Flash cards only really works if I use it shortly after the start of my laptop. Often, I want to change the brightness of the machine after I use the machine for an hour or two, but the uti

  • Server 2003r2 Sp2 many services do not start after chkdsk on restart has removed and replaced files

    Server work properly providing services, when on a restart to chkdsk, many files have been replaced with their default values. Since that time administrator is not displayed in the Task Manager users, no user name in the Task Manager process (no SYST

  • can't Defrag, Windows Vista

    I have windows vista, whenever I try and defrag, windows will ask my permission, I give, so nothing seems to happen. As far as I know, he is not defragment. Help?