×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    Somewhere, England
    Posts
    15

    Error with platform request/error with file reading

    Hi there

    I'm having an error using the platformRequest function on my nokia 6680. i have written a method that should connect to the internet and open the web browser on the phone to a particular google map. I've tested it using the wireless toolkit and everything works fine, but when i transfer it to the phone it doesnt launch the browser.

    the method is:
    Code:
    public void webLaunch(){
        boolean b;
        String address;
        double lat = convert(position1); //converts the position that i have saved into one recognised by google map
        double lon = convert(position2);
        address = "http://map.google.com/maps?q="+lat+",+"+lon;
        try {
          b=platformRequest(address);
          destroyApp(true);
          notifyDestroyed();
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
        }
        destroyApp(true);
        notifyDestroyed();
      }
    if i change the address to just http://map.google.com it works fine on the pfone, but it doesnt like it when the adress is in the format above, even though this is a valid address. Is there something i'm missing? i'm absolutely clueless as to why this isnt working...
    Last edited by andybeeeeee; 2006-04-27 at 17:26.

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Error with platform request

    Hi andybeeeeee,

    Note:

    "The MIDP 2.0 specification defines two URL schemes and corresponding platform services:

    * If the URL points to a MIDlet suite's JAD or JAR file, for example http://www.j2medeveloper.com/ota/basicpush.jad, the platform request is for download and installation of the MIDlet suite, using the platform's normal installation process.
    * If the URL scheme is tel:, for example tel:+358-555-1234567, the URL must be passed to the device's application responsible for initiating voice calls.

    Device manufactures are free to implement additional platform services. For example, one likely platform service would be to invoke a web browser when the MIDlet supplies an http: URL such as http://developers.sun.com/techtopics/mobility. "

    I do not think it's the case for Nokias but maybe there's an issue regarding 6680, perhaps it is not being able to parse this URL, but i think that would be strange...

    The complete article - Invoking Platform Services in MIDP 2.0
    http://developers.sun.com/techtopics...est/index.html

    The Javadoc comments for MIDlet.platformRequest state the same:

    "If the URL specified refers to a MIDlet suite (either an Application Descriptor or a JAR file), the application handling the request MUST interpret it as a request to install the named package. In this case, the platform's normal MIDlet suite installation process SHOULD be used, and the user MUST be allowed to control the process (including cancelling the download and/or installation). If the MIDlet suite being installed is an update of the currently running MIDlet suite, the platform MUST first stop the currently running MIDlet suite before performing the update. On some platforms, the currently running MIDlet suite MAY need to be stopped before any installations can occur.

    If the URL specified is of the form tel:<number>, as specified in RFC2806, then the platform MUST interpret this as a request to initiate a voice call. The request MUST be passed to the "phone" application to handle if one is present in the platform. The "phone" application, if present, MUST be able to set up local and global phone calls and also perform DTMF post dialing. Not all elements of RFC2806 need be implemented, especially the area-specifier or any other requirement on the terminal to know its context. The isdn-subaddress, service-provider and future-extension may also be ignored. Pauses during dialing are not relevant in some telephony services.

    Devices MAY choose to support additional URL schemes beyond the requirements listed above."

    Just curious, try replacing your code below with one that uses a StringBuffer and the toString() method, before invoking platformRequest. The results must be the same, though...

    address = "http://map.google.com/maps?q="+lat+",+"+lon;

    BR,

    Juarez Junior
    Last edited by juarezjunior; 2006-04-28 at 19:22.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Location
    Somewhere, England
    Posts
    15

    Re: Error with platform request

    after some digging around and trial and error i've found that the method that i posted above is fine, but theres another part of the application that isnt working properly. i'll post it here and change the title of the thread if i can so that i dont clog up the board with more error help requests.

    i think the problem with my app is now to do with the file reading. basically it should take a string from a text file of the form ". Latitude Longitude: 00112.7816 W" and chop it into 2 seperate strings, "5257.1222 N" and "00112.7816 W"

    once again, this works fine on the wireless toolkit, but is causing my program to throw an error on the method that i have given above.

    the method code is:
    Code:
     public void readFile() {
               try {
                  FileConnection filecon = (FileConnection)Connector.open("file:///c:/nokia/images/positions.txt");
                  // Always check whether the file or directory exists.
                  // Create the file if it doesn't exist.
                  if(!filecon.exists()) {
                     filecon.create();
                  }
    
                  DataInputStream is = filecon.openDataInputStream();
                  fileString = is.readUTF(is);
                  is.close();
                  filecon.close();
                } catch(IOException ioe) {
                  System.out.println("Error!!! " +ioe);
                }
         }
    
         public void trimString(){
          position1 = fileString.substring((fileString.length()/4), (fileString.length()/2));
          position2 = fileString.substring(((3*fileString.length())/4), fileString.length());
          }
    these two methods are called when the application starts and the variables in them are all global public variables

    why doesnt this work!?!

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    16

    Re: Error with platform request

    Hai andy

    Have u fixed the problem --> " b=platformRequest(address);"
    whether it works if we pass some string instead of platformRequest("http://...");

    TQ

Similar Threads

  1. Platform Request used for updating existing midletsuite?
    By hlothman in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2007-01-22, 20:41
  2. Platform Request API?
    By flyscorpio in forum Mobile Java General
    Replies: 0
    Last Post: 2005-06-19, 11:26
  3. 6230i Platform Request
    By acarroll3 in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-27, 17:11
  4. Platform Request on 6620
    By asubu in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2005-01-18, 14:36
  5. platform request on nokia 6600
    By scheung3 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-10-13, 23:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •