The J2ME application does not work in Nokia n81 and Samsung f330, etc., but it works in BB and Nokia n97, etc.

I made a small application in J2ME , it just opened a browser with a target link.

However, it works on some phone models, but not on others.

It works in:

  • BlackBerry 9000.
  • Nokia n97.
  • BlackBerry Javeline 8900

Id does not work :

  • Nokia e71: it installs the application, but the browser does not open.
  • Nokia n81: Idem.
  • Samsung f330: it cannot install the application.
  • BB 9800: Set OK. Browser with OK page. When you close the application, it starts again. (maybe using some kind of "finish" () in JavaME will help?)

I don’t know why it works on some phones, but not on others. Theoretically, it should work with every J2ME- enabled phone ( JavaME ).

EDIT . Here is the relevant code.

protected void startApp() throws MIDletStateChangeException { // TODO Auto-generated method stub boolean mustExit = false; try { /** * mustExit - Boolean * * Some MIDP platforms are more restricted than others. * For example, some don't support concurrent processing, * so the MIDlet must exit before the platform can honor * a service request. * * If <true> destroy the app. So the browser * can start. */ mustExit = platformRequest("http://www.stackoverflow.com"); } catch (ConnectionNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(mustExit){ destroyApp(true); notifyDestroyed(); } //Display.getDisplay(this).setCurrent(timeAlert); } 
+4
source share
1 answer

You should not do things like platformRequest in a lifecycle method like startApp() . This is an asynchronous operation, it should ask the user for permission, etc. This should not be done in the system thread.

The methods called by the system thread should return as close as possible to the maximum possible because the thread is likely to be responsible for other things, such as redrawing the screen or handling user input. platformRequest is a blocking operation and will cause the device to freeze.

Some devices can handle this better than others, so you see a mismatch.

Kill the new thread to do platformRequest , and everything should be fine; You can start your new stream almost anywhere.

+6
source

Source: https://habr.com/ru/post/1400441/


All Articles