This discussion is archived
1 Reply Latest reply: Mar 28, 2012 6:26 PM by 922951 RSS

Java Card Applet

926887 Newbie
Currently Being Moderated
Hi Everybody,

I am a beginner in the this field and trying to explore some things.

I am trying to develop a applet for a SIM card which will read the LOCI file in the File System and return the current location to the CAD.

It would be very helpful if you can guide me how to select a file from a java applet and then read the file.

Thanks a lot in advance.
  • 1. Re: Java Card Applet
    922951 Newbie
    Currently Being Moderated
    Dear Anurag ,

    Peace upon you.

    From API:

    The SIMView interface is the interface between the GSM System Services and any applet (SIM Toolkit or other). It offers some methods to communicate with the GSM System Services without compromising the GSM file system integrity (e.g. ME file context, conflicting access to files ...).

    Sample code to read the LOCI file look like this :


    private SIMView theGsmApplet;

    private byte[] buffer;//buffer that will contains the Location Area Information that will be shown on mobile screen

         public ConstructorToYourApplet()
         // get a reference to the GSM interface
    theGsmApplet = SIMSystem.getTheSIMView();

    // create the exchange buffer
    buffer = new byte[5];


              private void read_LOCI_File() {

              // select file using its path
    ;//select MF
    ;//select GSM
    ;//select LOCI
              theGsmApplet.readBinary((byte)4,buffer,(byte)0, (byte)5);          


    then use ProactiveHandler inside processToolkit() to send Proactive command "Display Text" to display buffer with MCC value from LOCI file like this:

    ProactiveHandler phandler;

    phandler.initDisplayText((byte) 0x80, (byte) 0x04,buffer, (short) 0, (short)buffer.length);

    Hope to be useful



  • Correct Answers - 10 points
  • Helpful Answers - 5 points