Detection of real device vs. Simulator

is there a way to detect if the application is running on a real device or a simulator.

Thank you.

DeviceInfo.isSimulator)

Tags: BlackBerry Developers

Similar Questions

  • Council of softkey is not coming by clicking textfield on Simulator, it will show on real device

    I wore an android application for bb 10 app, here I am facing problems.
    1 key board is not coming by clicking textfield on Simulator, it will show on real device

    2. I want to show 6 pictures long in size on a page to display scrolling but memory is out of range

    Hello

    No. 1: If you started the Q10 Simulator, it is expected for the real device has a physical keyboard. The Simulator startup, select the Z10 and test again to get the virtual keyboard.

    2: this question would better fit for a new topic. In any case, a strategy would be to cut the long cards for the smaller pieces and loading them dynamically, effectively keep in mind a few.

  • Custom BrowserField appears in the real device Simulator only

    Hey guys, I got some piece of code that I can use to display HTML data stored in a variable. It worked fine in the Simulator, but when I tried to view it on a real device (I use 8900), it shows nothing.

    Here is the code (HTMLField.java): (I use the code here: http://supportforums.blackberry.com/t5/Java-Development/Display-HTML-in-a-Screen-Field/td-p/335074/p...)

    package app;
    
    import java.io.IOException;
    
    import javax.microedition.io.HttpConnection;
    
    import net.rim.device.api.browser.field.BrowserContent;
    import net.rim.device.api.browser.field.Event;
    import net.rim.device.api.browser.field.RedirectEvent;
    import net.rim.device.api.browser.field.RenderingApplication;
    import net.rim.device.api.browser.field.RenderingException;
    import net.rim.device.api.browser.field.RenderingOptions;
    import net.rim.device.api.browser.field.RenderingSession;
    import net.rim.device.api.browser.field.RequestedResource;
    import net.rim.device.api.system.Application;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.Status;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.io.http.HttpHeaders;
    
    /**
     * A field which displays HTML content.
     * @author Febiyan Rachman
     */
    public class HTMLField extends VerticalFieldManager implements RenderingApplication
    {
        private String data;
        private static final String REFERER = "referer";
        private RenderingSession renderingSession;
        private HttpConnection currentConnection;
        private Field field;
    
        /**
         * Default constructor
         * @param data
         */
        public HTMLField(String data)
        {
            this.data = data;
            renderingSession = RenderingSession.getNewInstance();
            // Enable JavaScript
            renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_ENABLED, true);
        }
    
        /**
         * Start parsing thread
         */
        public void parseHTML()
        {
            if(!data.startsWith("";
            HTMLFieldConnection thread = new HTMLFieldConnection(data, null, this);
            thread.start();
        }
    
        /**
         * Parse HTML
         * @param data
         */
        public void parseHTML(String data)
        {
            this.data = data;
            if(!data.startsWith("";
            HTMLFieldConnection thread = new HTMLFieldConnection(data, null, this);
            thread.start();
        }
    
        /**
         *
         * @param connection
         * @param event
         */
        public void processConnection(HttpConnection connection, Event event)
        {
            // Cancel previous request
            if (currentConnection != null) {
                try
                {
                    currentConnection.close();
                }
                catch (IOException e1) {
                }
            }
    
            // Set the current connection to the created connection
            currentConnection = connection;
    
            BrowserContent browserContent = null;
    
            try
            {
                browserContent = renderingSession.getBrowserContent(connection, this, event);
    
                if (browserContent != null)
                {
                    // Create a field which displays the HTML content
                    Field newField = browserContent.getDisplayableContent();
                    // Add field to this manager
                    if (newField != null)
                    {
                        if(field != null)
                        {
                            synchronized (UiApplication.getEventLock())
                            {
                                replace(field, newField);
                                field = null;
                                field = newField;
                            }
    
                        }
                        else
                        {
                            synchronized (UiApplication.getEventLock())
                            {
                                add(newField);
                                field = newField;
                            }
    
                        }
                    }
    
                    // Finish!
                    browserContent.finishLoading();
                }
            }
            catch (RenderingException renderingException)
            {
                System.out.println("RenderingException : " + renderingException);
            }
            catch (Exception exception)
            {
                System.out.println("Exception : " + exception);
                exception.printStackTrace();
            }
        }
    
        /**
         * @see net.rim.device.api.browser.field.RenderingApplication#eventOccurred(net.rim.device.api.browser.field.Event)
         */
        public Object eventOccurred(Event event)
        {
            int eventId = event.getUID();
    
            switch (eventId)
            {
                case Event.EVENT_URL_REQUESTED:
                {
                    HTMLFieldConnection thread = new HTMLFieldConnection(data, null, this);
                    thread.start();
                    break;
                }
                case Event.EVENT_BROWSER_CONTENT_CHANGED:
                {
                    break;
                }
                case Event.EVENT_REDIRECT:
                {
    
                    RedirectEvent e = (RedirectEvent) event;
                    String referrer = e.getSourceURL();
    
                    switch (e.getType())
                    {
                        case RedirectEvent.TYPE_SINGLE_FRAME_REDIRECT:
                            // Show redirect message
                            Application.getApplication().invokeAndWait(new Runnable()
                            {
                                public void run()
                                {
                                    Status.show("You are being redirected to a different page...");
                                }
                            });
    
                            break;
    
                        case RedirectEvent.TYPE_JAVASCRIPT:
                            break;
                        case RedirectEvent.TYPE_META:
                            // MSIE and Mozilla don't send a Referrer for META Refresh.
                            referrer = null;
                            break;
                        case RedirectEvent.TYPE_300_REDIRECT:
                            // MSIE, Mozilla, and Opera all send the original
                            // request's Referrer as the Referrer for the new
                            // request.
                            Object eventSource = e.getSource();
                            if (eventSource instanceof HttpConnection)
                            {
                                referrer = ((HttpConnection) eventSource).getRequestProperty(REFERER);
                            }
                            break;
                    }
    
                    HttpHeaders requestHeaders = new HttpHeaders();
                    requestHeaders.setProperty(REFERER, referrer);
                    HTMLFieldConnection thread = new HTMLFieldConnection(this.data, event, this);
                    thread.start();
                    break;
    
                }
                case Event.EVENT_CLOSE:
                    break;
    
                case Event.EVENT_SET_HEADER:        // No cache support
                case Event.EVENT_SET_HTTP_COOKIE:   // No cookie support
                case Event.EVENT_HISTORY:           // No history support
                case Event.EVENT_EXECUTING_SCRIPT:  // No progress bar is supported
                case Event.EVENT_FULL_WINDOW:       // No full window support
                case Event.EVENT_STOP:              // No stop loading support
                default:
            }
    
            return null;
        }
    
        public int getAvailableHeight(BrowserContent browserContent)
        {
            return 0;
        }
    
        public int getAvailableWidth(BrowserContent browserContent)
        {
            return 0;
        }
    
        public String getHTTPCookie(String url)
        {
            return null;
        }
    
        public int getHistoryPosition(BrowserContent browserContent)
        {
            return 0;
        }
    
        public HttpConnection getResource(RequestedResource resource, BrowserContent referrer)
        {
            return null;
        }
    
        public void invokeRunnable(Runnable runnable)
        {
        }
    
    }
    

    BrowserApp.java

    package app;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.EditField;
    import net.rim.device.api.ui.container.MainScreen;
    
    /**
     * @author Febiyan Rachman
     */
    public class BrowserApp extends UiApplication implements FieldChangeListener
    {
        HTMLField htmlField;
        EditField textField;
    
        public static void main(String[] args)
        {
            // TODO Auto-generated method stub
            BrowserApp app = new BrowserApp();
            app.enterEventDispatcher();
        }
    
        /**
         * Default constructor
         */
        public BrowserApp()
        {
            MainScreen screen = new MainScreen();
            screen.setTitle("Browser Test");
            htmlField = new HTMLField("");
            //screen.add();
            textField = new EditField("Tes : ", "");
            ButtonField button = new ButtonField("click", ButtonField.CONSUME_CLICK);
            button.setChangeListener(this);
            screen.add(textField);
            screen.add(htmlField);
            screen.add(button);
            pushScreen(screen);
        }
    
        // parseHTML and display it
        public void fieldChanged(Field field, int context)
        {
            // TODO Auto-generated method stub
            htmlField.parseHTML(textField.getText());
        }
    
    }
    

    HTMLFieldConnection.java

    package app;
    
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    
    import javax.microedition.io.HttpConnection;
    
    import net.rim.device.api.browser.field.Event;
    
    public class HTMLFieldConnection extends Thread implements HttpConnection
    {
        private long streamLength = 7000;
        private DataInputStream dataInput;
        private InputStream in;
        private String encoding = "text/html";
        private HTMLField htmlField;
        private Event event;
        private String data;
    
        /**
         * Default
         * @param data
         * @param event : event object for eventOccured() function
         * @param htmlField : HTML display field
         */
        public HTMLFieldConnection(String data, Event event, HTMLField htmlField)
        {
            this.data = data;
            this.htmlField = htmlField;
            this.event = event;
        }
    
        public String getURL()
        {
            return "";
        }
    
        public String getProtocol()
        {
            return "";
        }
    
        public String getHost()
        {
            return "";
        }
    
        public String getFile()
        {
            return "";
        }
    
        public String getRef()
        {
            return "";
        }
    
        public String getQuery()
        {
            return "";
        }
    
        public int getPort()
        {
            return 0;
        }
    
        public String getRequestMethod()
        {
            return "";
        }
    
        public void setRequestMethod(String s) throws IOException
        {
    
        }
    
        public String getRequestProperty(String s)
        {
            return "";
        }
    
        public void setRequestProperty(String s, String s1) throws IOException
        {
    
        }
    
        public int getResponseCode() throws IOException
        {
            return 200;
        }
    
        public String getResponseMessage() throws IOException
        {
            return "";
        }
    
        public long getExpiration() throws IOException
        {
            return 0;
        }
    
        public long getDate() throws IOException
        {
            return 0;
        }
    
        public long getLastModified() throws IOException
        {
            return 0;
        }
    
        public String getHeaderField(String s) throws IOException
        {
            return "";
        }
    
        public int getHeaderFieldInt(String s, int i) throws IOException
        {
            return 0;
        }
    
        public long getHeaderFieldDate(String s, long l) throws IOException
        {
            return 0;
        }
    
        public String getHeaderField(int i) throws IOException
        {
            return "";
        }
    
        public String getHeaderFieldKey(int i) throws IOException
        {
            return "";
        }
    
        public String getType()
        {
            return "text/html";
        }
    
        public String getEncoding()
        {
            return encoding;
        }
    
        public long getLength()
        {
            return streamLength;
        }
    
        public InputStream openInputStream() throws IOException
        {
            return in;
        }
    
        public DataInputStream openDataInputStream() throws IOException
        {
            return dataInput;
        }
    
        public void close() throws IOException
        {
    
        }
    
        public OutputStream openOutputStream() throws IOException
        {
            return new ByteArrayOutputStream();
        }
    
        public DataOutputStream openDataOutputStream() throws IOException
        {
            return new DataOutputStream(new ByteArrayOutputStream());
        }
    
        public void run()
        {
             try
             {
                 in = new ByteArrayInputStream(data.getBytes("UTF-8"));
                 dataInput = new DataInputStream(in);
             }
             catch (Exception e)
             {
                 System.out.println("HttpConnectionImpl : Exception : " + e);
             }
            this.htmlField.processConnection(this, this.event);
        }
    }
    

    Is there something wrong with it?

    Yes, as I finally tried again and again, it seems that the OS 5 does not support old stuff like that, it has its own browserfield2.

  • can upload from a simulator but cant on real device

              /*
                 * HTTP Connections
                 */
                connDesc = connFact.getConnection(tempfile);
                httpConn = (HttpConnection)connDesc.getConnection();
                try {
                    if(httpConn.getResponseCode() == HttpConnection.HTTP_OK)
                    {
                        StatusScreen._filestatus.setText(localfilename);
                        int _fileSize = (int)httpConn.getLength();
                        StatusScreen._downstat.setText(Integer.toString(_fileSize));
                        /*
                         * File connection
                         */
                        FileConnection file = (FileConnection) Connector.open(appNameDir + localfilename , Connector.READ_WRITE);
                        file.create();
                        file.setWritable(true);
                        DataOutputStream oS = file.openDataOutputStream();                  
    
                        // set local file size
                        size = -1;
                        size = _fileSize;
                        // set downloaded file
                        downloaded = 0;
                        DataInputStream iS = httpConn.openDataInputStream();
                        while(fileDownloadStatus == 0)
                        {
                            byte[] buffer;
                            if(size - downloaded > MAX_BUFFER_SIZE)
                            {
                                buffer = new byte[MAX_BUFFER_SIZE];
                            }
                            else
                            {
                                buffer = new byte[size - downloaded];
                            }
                            int read = iS.read(buffer);
                            if(read == -1)
                            {
                                break;
                            }
                            oS.write(buffer, 0, read);
                            downloaded += read;
                        }
                        iS.close();
                        oS.close();
                        file.close();
    

    I have a problem downloading a real device file

    on real device the size of the file to the file will always be-1

    but on the Simulator, he will get the actual size...

    is there a problem with my code?

    There's a thread sticky in this forum, created by peter_strange:

    HTTP code and Access BIS-B connection example

    In my opinion, it is better that most of the books of BlackBerry - read it!

    The isssue is not exactly with your code - it is with the different ways in which the BlackBerry can connect to the Internet. Unfortunately, even a 'simple' download becomes a non-trivial task on it.

    See if playing with suffixes connection solve the problem - it could, it could not

  • A simulator to simulate efficiently all limitations of a real device?

    I brought an IPhone app to BlackBerry and it works great on the Simulator.  One of IPHONE developers theother said day "wait until you get your application on the actual device. That's when the pain begins"and he stopped dead in my tracks. The big question is, it works perfectly in the real device too. Is the Simulator has the processor, memory, and any other restrictions of a real device?

    PS. can't afford a real device, so stuck with the blessed simulators.

    See you soon.

    Not sure that I count as a guru, but happy to offer my thoughts.

    Basically, I agree with the previous answers, you've had.

    Not sure if anyone has mentioned code signing and prompts security/permissions variety you can get on a real device.  I would recommend that you get the key signing, even if you need and sign your code for $20.  There is a good video on security prompts that I recommend that see you, too.  And business users would never be able to run your application due to the security provisions in the company.

    Relating to the performance, don't forget that the Simulator is faster than the device.  Much faster.  The one that annoys me is the time it takes for a page in the browser.  I have not done much image manipulation, but I think that the same thing happens with her.

    Concerning the aspect, the storm must be the biggest difference.  Remember that you are using a mouse on the simulator that is easy to point.  The simulator of life-size scale and then try to put your fingers on the screen to see if your fields are in fact quite large.  And you will find the keys on the real QWERTY devices a little different and surprisingly, different between different models.

    Get cod on the device takes a little thought.

    If a few other things, but the guys have already hit on the most important.

  • Screen orientation: real device vs. Simulator

    Hey guys (and girls).

    So yesterday when I got the SDK and harry first noticed a problem of orientation. To be honest, I couldn't even turn the unit in the Simulator (subsequently discovered click and drag). in any case, my current application is built assuming that we don't see rotation capabilities in the Simulator until later. But now that we have received the Simulator updated we can finally do some tests of rotation. So here's what we found:

    After you have added the following lines to the file - app.xml:

    false
    landscape
    

    I compile and run my app in debug mode in the Simulator. Works without a hitch. I do the click and drag the motion to rotate the Simulator. Does not work. Now I'll assume that this happens because I put the autoOrient false value. So now so far so good. If the user decides to rotate the unit while using my app it would remain the same (I was intending to do the portrait of mode changes later).

    So what's the problem. After I slide up on my request to minimize it while remaining in the fashion landscape, it appears as a normal horizontal application. Now if I were to click and drag the motion to make rotate the Simulator Simulator rotates - but not my application. Now, because it was shot all being reduced at least my application is still assuming that the device is in landscape mode and rest in the same form. Now when I maximize my app while still in portrait mode, it looks pretty bad to say the least. an application of landscape in portrait form factor - not a pretty picture.

    In the case where I have everybody scratching their heads, here are the steps to re - create (that's all assuming that your application is set to show only in landscape mode):

    1. Make a wonderful app
    2. Put the above code lines in your - app.xml file to avoid the orientation change.
    3. Compile and run / debug your application on the Simulator
    4. Assuming that your Simulator has not frozen (har har ) try to rotate the screen.
    5. After finding out, you are not able to rotate the screen, minimize your application with a sliding upward.
    6. Now turn your Simulator via the drag and turn motion (lower right in the middle of the screen)
    7. Now look at the way that your minimize the looks of the app.
    8. Maximize your single app landscape.
    9. Cringe.

    If you followed the steps in this order, you should be able to understand now if you have not already before.

    so my question is, is the same expected behavior of the real device? or will a single minimized application landscape turned to always be in mode 'landscape' and not stretched to fit the portrait mode?

    Thanks for any information / suggestion / effort of collaboration in advance!

    (btw while typing this workaround came to mind where I could check the current ratio of the height and the width of the stage and the direction myself - I'll keep you posted!)

    Even here, I will just wait. It works perfectly in Android (sim and device) so here I will not write code to fix something that will be fixed when it comes out (they can't leave it like that)

  • Application of background visible on a real device (all well in the Simulator)

    Hello

    I developed a small backgroundapplication, which shows a menu entry in the app phone "call via Asterisk. If I choose this option a defined number is called. Later, I want to add the number as dtmf tones.

    The application uses excactly as expected in the device Simulator 8310-JDE (included in the eclipse plugin) on JDE 4.5. with eclipse.

    But when I deploy the application (signed) to a real 8310 with firmeware v4.5.0.81, it appears an application icon on the desktop (homescreen) of blackberry and the menuentry in the phone app is missing. Why the application is not deployed as a background on the real dev app. ?

    The only difference between the Simulator and real device is the language chosen, but I don't think it's important.

    The application consists of files, as shown below.

    import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;import net.rim.device.api.system.Application;
    
    public class Asterisk extends Application {   public static void main(String[] args)    {            // Create a new instance of the application            // and start it's event thread.            new Asterisk().enterEventDispatcher();    }
    
        public Asterisk()    {        //create a new instance of the menuitem       AsteriskMenuItem asterisMenuItem = new AsteriskMenuItem(40);
    
          //get the instance of the standard-menu an ad the new menuitem        ApplicationMenuItemRepository     .getInstance().addMenuItem        (ApplicationMenuItemRepository.MENUITEM_PHONE,asterisMenuItem);
    
        }}
    
    package com.schiffl.mobile.asteris;
    
    import net.rim.blackberry.api.invoke.Invoke;import net.rim.blackberry.api.invoke.PhoneArguments;import net.rim.blackberry.api.mail.Message;import net.rim.blackberry.api.menuitem.ApplicationMenuItem;import net.rim.blackberry.api.phone.Phone;import net.rim.blackberry.api.phone.PhoneCall;import net.rim.blackberry.api.phone.PhoneListener;import net.rim.device.api.system.ControlledAccessException;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.UiApplication;
    
    public class AsteriskMenuItem  extends ApplicationMenuItem{     //number to be dialed via Asterisk        String servicenumber  = "1234567";
    
          //using the default constructors here.        AsteriskMenuItem(int order)       {         super(order);     }
    
           //methods we must implement       //Run is called when the menuItem is invoked      public Object run(Object context)     {             /*             * Normally the dialed number could be found in the context object             * because of a bug in the api which is solved in v.4.7 the context            * object is always null for MENUITEM_PHONE so it is necessary to          * use a workaround, here the number is extracted from the field with focus,           * which contains the dialed number           */            Field myField = UiApplication.getUiApplication().getActiveScreen().getFieldWithFocus();           String phoneNumber = myField.toString();
    
              //TODO Convert phoneNumber to dtmf-tones
    
              try           {             PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL,servicenumber);              Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
    
    //                PhoneCall myCall = Phone.getActiveCall();//               myCall.sendDTMFTones(phoneNumber);            }         /*             * The ControlledAccessException is thrown             * if the system administrator restricts access to the phone application           * using application control.          */           catch (ControlledAccessException e)           {             //TODO some exceptionhandling             }
    
             //normally you can do something with the given context inside of the run-method           //because of a bug in the API the context is always null so, we don't use it...           return context;       }
    
           //toString should return the string we want to        //use as the lable of the menuItem        public String toString(){         return "Call via Asterisk";       }
    
    }
    

    The entry for the RRT signature was missing in my .csl file. I change it manually, I added

    '52525400 = RIM API execution' requested signatures, deployed and it works...

  • The difficulty to launch android applications reconditioned on device PlayBook (Simulator OK)

    Just updated my android app and it passed verification.  I will install on my PlayBook, and it won't start.

    The application works on the new 2.0 PlayBook Simulator very well, but when I go to install on the current device, it installs, but will not start.

    I tried without success (all these I tried both USB and WiFi connection) the following:

    • Restart the PlayBook after the 2.0 update (several times)
    • Signature of the bar and the deployment using command-line tools
    • Do not sign the bar and deployment via command line tools (after configuring Debug token)
    • Deployment by using the new eclipse plugin - is to expire, I have even increased the time-out value of 60 seconds and much more), it gets stuck on "Launch BlackBerry Android Runtime."... ", then a message that says" failed to connect ├a 192.168.1.139 to BAD! »

    Also, I'm under Mac OSX Lion and v2.0.0.3778 PlayBook.

    Anyone else having any of these issues or having luck getting your reconditioned apps to run on the real device?

    Any of you installed a pre-beta version of an Android player that has been disclosed on another forum?

    Whether a security wipe can be in the order that I suspect that the two versions of the player are probably in conflict!

    HTH - Rufus.

  • Impossible to debug on real device

    Hello

    When I try to debug an application on a real device debugging I get an error that a debug file is missing.

    After the tutorial on http://supportforums.blackberry.com/rim/attachments/rim/java_dev@tkb/18/1/How_to_Debug_and_Optimize _... he said that I may receive this error if "the reason why this might happen is that the version of the software on your device does not correspond to the.
    the software version of your Simulator

    I use blackberry curve withDevice software versio 5.0.0.103

    The research unit of the Simulator for OS 5.0.0 it does'nt seem to be a simulator for this version of the software.

    What can I do?

    You must launch the application manually on the device. I don't know why the breakpoints are not recognized. Try to delete the app, reboot the device, the app package, sing, load (debug as)... you can tell that the debugger is attached with success by the lines displayed in the Console view.

  • How to debug on a real device?

    Hello everyone,

    I'm a new java developer using Eclipse plug-ins. every time when I had mistakes, only to debug codes on the Simulator, but I want the debugging on a real device. I already sign with BlackBerry $ 20. You guys can tell me how, please?

    Thank you

    Concerning

    In Eclipse:

    - Run > Debug Configurations...

    -Click Terminal BlackBerry on your left and then click the new (blank page with star.

    - Check the projects you want to deploy on your device.

    -Click the general tab and select debugging under "display in Favorites menu".

    -Make sure that your device is connected, and then press the debug button.

    -In the future, looking for a Bug icon in your toolbar, and then click the arrow next to it, then click on your project.

  • Problem test on a real device - app does not start

    I use

    Eclipse 3.5 Galileo

    BlackBerry JDE 5.0

    BlackBerry Desktop Software 6.0.0.43

    a real device Curve 8900 with the software updated to 5.0.0.681.

    I read that Simulators have problems with Blackberry Maps. So, I wanted to test my application on the actual device to see if I've run into the same errors. Packaging and code-signing everything has worked well. I then installed the software on the device through Blackberry Desktop software. I found the icon in the downloads folder of the device but you cannot start the application. When I click on it nothing happens. No no error message, nothing, simply no reaction. So I have no idea what went wrong. Does anyone have an idea or suggestion how know what's the problem?

    I can start and run the program on the Simulator.

    Hi navad.

    I had the same problem a few days ago.

    Only the developed app one shows no reaction. all other things are working well.

    to me, helped the following:

    When the Blackberry is running, remove the battery and wait 2 minutes.

    Replace the battery and the blackberry again.

    After that, you should be able to run your application.

    I hope this will help.

    CU

    Michael

  • Unable to connect to my real device webservice (KSOAP)

    Hello friends of BB,

    I wrote an application for my black berry. My application to connect to a PHP Web service. I use the ksoap library to connect to my webservice. It works on my Simulator, but when I add my request on my real device does not connect to my webservice. I think I need to add something to my url. I call this URL:

    final String url = http://www.*****.de/webservice/dbservice.php
    
    final HttpTransport http = new HttpTransport(url);
    
    ...
    

    I hope someone can help me.

    greeting

    Dennis

    See the sticky thread here.

    http://supportforums.BlackBerry.com/T5/Java-development/connecting-your-BlackBerry-http-and-socket-c...

    As you can guess, this question has been answered repeatedly asked.

    In short, the Simulator emualtes a device connected to BES (if MDS - CS is running), it is not necessary for URL parameters in this environment.

    However, once you get on a real device that is not connected to BES, you will need to do a bit of work to determine what types of connectivity are available and develop your parameters of connection accordingly.

    A direct TCP connection (for example) will require "; deviceside = true' + settings specific to the network of the AFN.

    See this article:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

  • Event: MouseEvent on real device

    Simple but important question:

    does

    event:MouseEvent
    

    work on real devices? I know that it works on the Simulator, but since there are some differences in the Simulator vs the real device behavior, it could be good to know.

    Hey,.

    Yes MouseEvents are similar to the events of "a touchpoint." So they will work the same as a simple "touch". Also its been recommended if you use the key that one point, you should stick with mouseevents because they use fewer resources. Good luck!

  • Place of current residence (Longitude/Latitude) GPS does not work on real device

    Hello

    I wrote a small test application for GPS/latidue longitude. It works fine on simulator (9630), but not on the real device (BlackBerry Tour). Am I missing something? I have to set anything on the device? I already have the data plan activated in the device. Should I have any extra service from the supplier in order to let this GPS thing work?

    Here's my test code:

    public class GPSDemoScreen extends MainScreen implements FieldChangeListener{
        private ButtonField btnGPSTest;
        private EditField edStatus;    
    
        private BBTest bbTest = null;
        private VerticalFieldManager vfManager = null;
    
          // Constants -----------------------------------------------------------------------------------------------------------------
        private static final int GRADE_INTERVAL=5;  // Seconds - represents the number of updates over which alt is calculated.
     //   private static final long ID = 0x5d459971bb15ae7aL; //com.rim.samples.device.gpsdemo.GPSDemo.ID
        private static final int CAPTURE_INTERVAL=5;    // We record a location every 5 seconds.
        private static final int SENDING_INTERVAL=30;   // The interval in seconds after which the information is sent to the server.
    
        // When running this application, select options from the menu and replace 
        // with the name of the computer which is running the GPSServer application found in
        // com.rim.samples.server, typically the local machine.  Alternatively, the _hostName variable
        // can be hard-coded below with no need to further modify the server name while running the application.
    
        private static int _interval = 1;   // Seconds - this is the period of position query.
        private static float[] _altitudes;
        private static float[] _horizontalDistances;
    
         private long _startTime;
        private float _wayHorizontalDistance;
        private float _horizontalDistance;
        private float _verticalDistance;
        private StringBuffer _messageString;
        private LocationProvider _locationProvider;
        //private ServerConnectThread _serverConnectThread;   
    
        /** Creates a new instance of GPSDemoScreen */
        public GPSDemoScreen(BBTest bbtest) {
            super(DEFAULT_MENU | DEFAULT_CLOSE);
            bbTest = bbtest;
    
            initComponent();
        }
    
        private void initComponent(){
            this.setTitle("GPS Demo");
         //   this.bbTest.setBGImage(vfManager, this);
            // Used by waypoints, represents the time since the last waypoint.
            _startTime = System.currentTimeMillis();
            _altitudes = new float[GRADE_INTERVAL];
            _horizontalDistances = new float[GRADE_INTERVAL];
            _messageString = new StringBuffer();
    
            btnGPSTest = new ButtonField("GPS Test", ButtonField.CONSUME_CLICK);
            btnGPSTest.setChangeListener(this);
            edStatus = new EditField( Field.NON_FOCUSABLE);
            edStatus.setText("retriving Longitude and Latitude.Please wait..");
            this.add(btnGPSTest);
            this.add(edStatus);
    
        }
    
         /**
         * Rounds off a given double to the provided number of decimal places.
         * @param d The double to round off.
         * @param decimal The number of decimal places to retain.
         * @return A double with the number of decimal places specified.
         */
        private static double round(double d, int decimal)
        {
            double powerOfTen = 1;
    
            while (decimal-- > 0)
            {
                powerOfTen *= 10.0;
            }
    
            double d1 = d * powerOfTen;
            int d1asint = (int)d1; // Clip the decimal portion away and cache the cast, this is a costly transformation.
            double d2 = d1 - d1asint; // Get the remainder of the double.
    
            // Is the remainder > 0.5? if so, round up, otherwise round down (lump in .5 with > case for simplicity).
            return ( d2 >= 0.5 ? (d1asint + 1)/powerOfTen : (d1asint)/powerOfTen);
        }
    
         /**
         * Invokes the Location API with the default criteria.
         *
         * @return True if the Location Provider was successfully started; false otherwise.
         */
        private boolean startLocationUpdate()
        {
            boolean retval = false;
    
            try
            {
                _locationProvider = LocationProvider.getInstance(null);
    
                if ( _locationProvider == null )
                {
                    // We would like to display a dialog box indicating that GPS isn't supported,
                    // but because the event-dispatcher thread hasn't been started yet, modal
                    // screens cannot be pushed onto the display stack.  So delay this operation
                    // until the event-dispatcher thread is running by asking it to invoke the
                    // following Runnable object as soon as it can.
                    Runnable showGpsUnsupportedDialog = new Runnable()
                    {
                        public void run() {
                            Dialog.alert("GPS is not supported on this platform, exiting...");
                            System.exit( 1 );
                        }
                    };
    
                    UiApplication.getApplication().invokeLater( showGpsUnsupportedDialog );  // Ask event-dispatcher thread to display dialog ASAP.
                }
                else
                {
                    // Only a single listener can be associated with a provider, and unsetting it
                    // involves the same call but with null, therefore, no need to cache the listener
                    // instance request an update every second.
                    _locationProvider.setLocationListener(new LocationListenerImpl(), _interval, 1, 1);
                    retval = true;
                }
            }
            catch (LocationException le)
            {
                System.err.println("Failed to instantiate the LocationProvider object, exiting...");
                System.err.println(le);
                System.exit(0);
            }
            return retval;
        }
          /**
         * Update the GUI with the data just received.
         */
        private void updateLocationScreen(final String msg)
        {
            UiApplication.getApplication().invokeLater(new Runnable()
            {
                public void run()
                {
                    System.out.println(msg.toString());
                    edStatus.setText(msg);
                    Dialog.alert(msg.toString());
                }
            });
        }
    
      public void fieldChanged(Field field, int context){
             if(field.equals(btnGPSTest)){
                startLocationUpdate();
             }
    
         }
        /** Standard Escape-key handler */
        public boolean keyChar(char key, int status, int time) {
            boolean retval = false;
            switch (key) {
                case Characters.ESCAPE:
                   // UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
                    break;
                default:
                    retval = super.keyChar(key, status, time);
            }
            return retval;
        }
    
         /**
         * Implementation of the LocationListener interface.
         */
        private class LocationListenerImpl implements LocationListener
        {
            // Members ----------------------------------------------------------------------------------------------
            private int captureCount;
            private int sendCount;
    
            // Methods ----------------------------------------------------------------------------------------------
            /**
             * @see javax.microedition.location.LocationListener#locationUpdated(LocationProvider,Location)
             */
            public void locationUpdated(LocationProvider provider, Location location)
            {
                try{
                    if(location.isValid())
                    {
                        float heading = location.getCourse();
                        double longitude = location.getQualifiedCoordinates().getLongitude();
                        double latitude = location.getQualifiedCoordinates().getLatitude();
                        float altitude = location.getQualifiedCoordinates().getAltitude();
                        float speed = location.getSpeed();                
    
                        // Horizontal distance to send to server.
                        float horizontalDistance = speed * _interval;
                        _horizontalDistance += horizontalDistance;
    
                        // Horizontal distance for this waypoint.
                        _wayHorizontalDistance += horizontalDistance;
    
                        // Distance over the current interval.
                        float totalDist = 0; 
    
                        // Moving average grade.
                        for(int i = 0; i < GRADE_INTERVAL - 1; ++i)
                        {
                            _altitudes[i] = _altitudes[i+1];
                            _horizontalDistances[i] = _horizontalDistances[i+1];
                            totalDist = totalDist + _horizontalDistances[i];
                        }
    
                        _altitudes[GRADE_INTERVAL-1] = altitude;
                        _horizontalDistances[GRADE_INTERVAL-1] = speed*_interval;
                        totalDist= totalDist + _horizontalDistances[GRADE_INTERVAL-1];
                        float grade = (totalDist==0.0F)? Float.NaN : ( (_altitudes[4] - _altitudes[0]) * 100/totalDist);
    
                        // Running total of the vertical distance gain.
                        float altGain = _altitudes[GRADE_INTERVAL-1] - _altitudes[GRADE_INTERVAL-2];
    
                        if (altGain > 0)
                        {
                            _verticalDistance = _verticalDistance + altGain;
                        }
    
                        captureCount += _interval;
    
                        // If we're mod zero then it's time to record this data.
                        captureCount %= CAPTURE_INTERVAL;
    
                        // Information to be sent to the server.
                        if ( captureCount == 0 )
                        {
                            // Minimize garbage creation by appending only character primitives, no extra String objects created that way.
                            _messageString.append(round(longitude,4));
                            _messageString.append(';');
                            _messageString.append(round(latitude,4));
                            _messageString.append(';');
                            _messageString.append(round(altitude,2));
                            _messageString.append(';');
                            _messageString.append(_horizontalDistance);
                            _messageString.append(';');
                            _messageString.append(round(speed,2));
                            _messageString.append(';');
                            _messageString.append(System.currentTimeMillis());
                            _messageString.append(':');
                            sendCount += CAPTURE_INTERVAL;
                            _horizontalDistance = 0;
                        }
    
                        // If we're mod zero then it's time to send.
                        sendCount %= SENDING_INTERVAL;
    
                        synchronized(this)
                        {
                            if (sendCount == 0 && _messageString.length() != 0)
                            {
                            //  _serverConnectThread.sendUpdate(_messageString.toString());
                                _messageString.setLength(0);
                            }
                        }
    
                        // Information to be displayed on the device.
                        StringBuffer sb = new StringBuffer();
                        sb.append("Longitude: ");
                        sb.append(longitude);
                        sb.append("\n");
                        sb.append("Latitude: ");
                        sb.append(latitude);
                        sb.append("\n");
                        sb.append("Altitude: ");
                        sb.append(altitude);
                        sb.append(" m");
                        sb.append("\n");
                        sb.append("Heading relative to true north: ");
                        sb.append(heading);
                        sb.append("\n");
                        sb.append("Speed : ");
                        sb.append(speed);
                        sb.append(" m/s");
                        sb.append("\n");
                        sb.append("Grade : ");
                        if(Float.isNaN(grade))sb.append(" Not available");
                        else sb.append(grade+" %");
                        GPSDemoScreen.this.updateLocationScreen(sb.toString());
                    }
                }catch(Exception ex){
                    System.out.println(ex.toString());
                    ex.printStackTrace();
                }
            }
    
            public void providerStateChanged(LocationProvider provider, int newState)
            {
                // Not implemented.
            }
        }
    }
    

    It works fine now, when I tried door.

  • How to develop and test the application mobile flex without the real device?

    I'm trying to read some information about it, but decided to ask also here.

    I have a project that has a company wants to grow me, it's for iPad. That's ok I am with Flex and the framework for web development, but not for mobile. Why? Because I have no idea how to test my application. I know generation ago it sort of the desktop version of the application with the change of the "back" button on the orientation stuff, but how do I know my application will look and work exactly the same (I mean NOT performance here). I mean you know how every android or iOS device have their native keyboard or native video player for example and I have only in the debug version of the application.

    The question is how to develop this application based on the desktop emulator or anything and then hope that my app looks and works on a device, as it should... Of course I can't afford to buy all the devices it is just to be able to test on it if necessary? So, how do you, how to test how my iPad app works on a device without a? I know I should get a licence from iOS dev to be able to package the app for iOS, but it's $ 99 per year or something like that I can handle, but how to test my application without having to buy the darn device? Are there any emulator for iPad or something like that I know what my customers will see when they get the application? One of my friends told me that the mac os x use the developers a tool - cause some kit of dev who has emulators for all iOS devices and you can build and test there immediately and that you can simulate virtually any combination of key for example, and he said he's working and seems to 1:1 as the real device but he didn't know if can I export an AIR application and try it like this, he only knew for app written in native code.

    If someone can just tell me how should I do this? Should I buy a mac os x computer laptop to test because I am a user of windows 7, or perhaps create a mac os x virtual machine and tests out there or maybe the only option is to actually buy the device... that would be terrible for a freelancer...

    I hope someone can save the day here! Thank you.

    F

    Since the AIR for iOS applications are compiled to ARM code you will not be able to run on iOS emulators running on Mac OSX.

    You can do a very simple test with the "Simulator" built into Flash Builder, but it is not much more than a window to AIR with a window size that matches the resolution of the selected iOS device.  When running in the simulator of the application is not compiled to ARM code so it will take a completely different code path than what will be the final release of iOS.

    Ultimately if you are developing for iOS with AIR nothing but for tests on real iOS devices.

Maybe you are looking for

  • Satellite L455-S5009 - no function only if displayed when you press FN

    Hello! I installed WIndows 7 (64-bit) ultimate, before pressing the FN key, there was the small screen that has used to come on my screen, display, that works of bottons for what to do, but now he is not something showed when I press the FN key. FN +

  • Satellite M70-394: badge on the cover by pulling upward on one side

    Keep pulling upward on one side and me is annoying, especially since it is only a week old. Toshiba will send me a new? What should I do?

  • hp7520 disable wireless or hide the SSID

    Hello. I have a HP Photosmart 7520. It works fine except my client does not want the ssid broadcast in the doctor's office. It is already password protected, but he dislikes the ssid 'disorder' in the air. I would like to disable Wi - Fi to the print

  • BlackBerry new Z10 Delete window

    The update came with the old window remove hub or remove hub and the good server thing, I accidentally hit don't show this again option how to return this window?

  • BBM bbm surveys disappears

    I have improved my bbm and after that reboot the device bbm no longer appears, I don't know what the problem might be that anyone can help please!