|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
WebSessionBrowserMsgListener | A listener of browser message events. |
Class Summary | |
---|---|
OTADownload | OTADownload API enables triggering OTA provisioning using the OTA Download start methods. |
WebSession | Holds internet configuration parameters associated/needed in a Web Session. |
WebSessionManager | WebSessionManager class provides a full control over the internet configuration. |
Exception Summary | |
---|---|
OTAException | OTA API's specific exception. |
WebSessionException | WebSession API specific exception. |
Configure air link parameters associated/needed with an internet or MMS session; Trigger and perform OTA download of a new MIDlet.
import javax.microedition.io.*; import com.motorola.oem.*; public class WebSessionMIDlet extends MIDlet{ ... public void startApp() { WebSession ws = new WebSession(); ws.setSessionName("Java Session"); ws.setProxy1("011.011.011.011");// gateway IP ws.setGprsApn("internet"); ws.setGprsUserName("moto"); ws.setGprsPassword("rola"); try{ WebSessionManager.updateWebSession(ws, WebSessionManager.SESSION_INDEX_JAVA); }catch(WebSessionException e){ ... } ... } |
import com.motorola.oem.*; public class WebSessionMIDlet extends MIDlet{ ... public void startApp() { WebSession ws = new WebSession(); ws.setSessionName("Mms Session"); ws.setHomePage("192.168.220.15/servlets/mms"); ws.setProxy1("192.118.11.55"); ws.setServiceType1(WebSession.SERVICE_TYPE_WAP); ws.setPort1(9201); ws.setServiceType2(WebSession.SERVICE_TYPE_WAP); ws.setGprsApn("wap.orange.co.il"); ... try{ // Optional WebSessionManager.updateWebSession(ws, WebSessionManager.SESSION_INDEX_MMS); }catch(WebSessionException oe){ ... oe.printStackTrace(); } |
import javax.microedition.io.*; import com.motorola.oem.*; public class WebSessionMIDlet extends MIDlet{ private int UserSessionIndex; ... public void startApp() { WebSession ws = new WebSession(); ws.setSessionName("User Session"); ws.setProxy1 ("011.011.011.011");// gateway IP ws.setGprsApn ("internet"); ws.setGprsUserName("moto"); ws.setGprsPassword("rola"); try{ // Optional(recommended) - Store session as a WebSession entry for a future use. UserSessionIndex = WebSessionManager.addWebSession(ws); // Set the current 'User Session' web session's parameters WebSessionManager.setCurrentWebSession(UserSessionIndex); }catch(WebSessionException e){ ... } ... } |
import com.motorola.oem.*; public class WebSessionMIDlet extends MIDlet{ // Recommended - preserve the OTA dedicated WS entry reference for the future private int OTASessionIndex; ... public void startApp() { WebSession ws = new WebSession(); ws.setSessionName("OTA Session"); // set Server's URL for MIDlet download ws.setHomePage("www.motbrw.com/kjava/g24_cc/ota/vend.jad"); ws.setGprsApn( "internet"); ws.setGprsUserName("moto"); ws.setGprsPassword("rola"); try { // Store OTA session as a WebSession entry OTASessionIndex = WebSessionManager.addWebSession (ws); //SW update point reached OTADownload.startOTA (OTASessionIndex); } catch (Exception ex) { ... } ... |
import com.motorola.oem.*; public class WebSessionMIDlet extends MIDlet { private String OTASessionURL = "www.motbrw.com/kjava/g24_cc/ota/vend.jad"; ... public void startApp() { try{ //SW update point reached OTADownload.startOTA(OTASessionURL); }catch(WebSessionException e){ ... } |
import com.motorola.oem.websession.*; import javax.microedition.midlet.MIDlet; public class WebSessionExample extends MIDlet implements WebSessionBrowserMsgListener { // USERPIN code. // Used when receiving browser messages which requires USERPIN. private final static String pin1Code = "1234"; // Stores the WebSessionManager only instance. private WebSessionManager webSessionManager; public void startApp() { try { webSessionManager = WebSessionManager.getInstance(); } catch (WebSessionException wse) { System.out.println("Error: Cannot get WebSessionManager instance"); wse.printStackTrace(); } if (webSessionManager != null) { // Start listening to browser messages webSessionManager.setBrowserMsgListener(this); System.out.println("Browser message listener started"); } } // Implements WebSessionBrowserMsgListener interface method. public void onBrowserMsgReceived(int securityMethod) { System.out.println("New settings arrived"); int browserMsgType; try { if (securityMethod == WebSessionManager.AUTH_METHOD_NETWPIN) { // Security method does not require USERPIN browserMsgType = webSessionManager.acceptBrowserMsg(); } else { // Security method requires USERPIN browserMsgType = webSessionManager.acceptBrowserMsg(pin1Code); } processProvSession(browserMsgType); } catch (WebSessionException wse) { System.out.println("Error: Cannot accept Web Session"); wse.printStackTrace(); } } // Copies the "Prov Session" web session to the "Java Session" web session or the "Mms Session" web session. // @param browserMsgType The type of web session that was provisioned // @throws com.motorola.oem.websession.WebSessionException Thrown if the "Prov Session" web session is not available or if the destination web session could not be updated private void processProvSession(int browserMsgType) throws WebSessionException { WebSession webSession = WebSessionManager.getWebSession(WebSessionManager.SESSION_INDEX_PROV); // "Prov Session" access type is always read only, change it to read / write webSession.setAccessType(WebSession.ACCESS_RW); String sessionName; int sessionIndex; if (browserMsgType == WebSessionManager.BROWSER_SETTINGS_PROVISIONING_WEB) { sessionName = "Java Session"; sessionIndex = WebSessionManager.SESSION_INDEX_JAVA; } else { sessionName = "Mms Session"; sessionIndex = WebSessionManager.SESSION_INDEX_MMS; } webSession.setSessionName(sessionName); WebSessionManager.updateWebSession(webSession, sessionIndex); System.out.println(sessionName + " was updated"); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } } |
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |