Source code for CellTrack – My J2ME Cell Broadcast System (CBS) Tracking App

Today, I was finally able to get hold of the JAR file of my CellTrack J2ME. As I had mentioned earlier, all my J2ME apps had vanished from my computer. There was a possibility decompile Java class file in the JAR and extract the source code but JAR file for the CellTrack JAR was missing. I could trace all JAR files for all the other apps that I had created.

However, I realized that when I installed the app to my Motorola V3 RAZR phone, it received the JAR and the JAD file. There were two app that did the same thing for some reason. So, the JAR was in the phone. However, getting it back was not easy.

The Motorola Mid-Way app will install JARs and JADs but will not extract it. There was however other apps that could do it. When V3 was released, it caused quite a sensation among the public and was sold in large numbers. Several people had created apps to tinker with it. There was one guy who had replaced the startup GIF file with one modified to look like Windows XP. He had also added the Windows Start wave file to it making the effect complete.

Anwyay, the tool to read the Motorola’s internal file system is P2K Commander. This is now an abandoned software. The installed JAR will be renamed in an unrecognizable manner. You need to open each of them in a archive viewer such as IZarc. Then, use JAD Decompiler, another by Pavel Kouznetsov, which is another abandoned software. This decrypted the class file in the JAR file when used with the -sjava parameter.

CBS-based cell-tracking J2ME app running on Motorola V3 RAZR

So, now, here is the source code:

// Source File Name:   CellTrack.java
// (C) V. Subhash, 2013-2014.
/// All rights reserved.

import java.io.IOException;
import java.io.PrintStream;
import java.util.Date;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.wireless.messaging.*;

public class CellTrack extends MIDlet
    implements MessageListener, CommandListener {

  private Display display;
  MessageConnection msgconn;
  TextMessage txtmsg;
  String from;
  String Msg;
  List lstCells;
  Date dt;
  Command cmdExit;

  public CellTrack(){
  }

  protected void destroyApp(boolean unconditional)
      throws MIDletStateChangeException {
    notifyDestroyed();
  }

  protected void pauseApp() {
  }

  protected void startApp()
      throws MIDletStateChangeException {
    display = Display.getDisplay(this);
    lstCells = new List("Cell Towers", 1);
    cmdExit = new Command("Exit", 7, 1);
    lstCells.addCommand(cmdExit);
    lstCells.setCommandListener(this);
    display.setCurrent(lstCells);
    setupListening();
  }

  public void setupListening() {
    try {
      if (msgconn == null) {
        msgconn = (MessageConnection)Connector.open("cbs://:50");
        msgconn.setMessageListener(this);
      }
    } catch(IOException e) {
      lstCells.append("Error: " + e.getMessage() + e.getClass().getName(), null);
    }
  }

  public void notifyIncomingMessage(MessageConnection conn) {
    dt = new Date();
    try {
      txtmsg = (TextMessage)msgconn.receive();
    } catch(Exception e) {
      System.out.println(e);
    }
    from = txtmsg.getAddress();
    Msg = txtmsg.getPayloadText();
    lstCells.append(Msg + " \n(" + dt.toString() + ")", null);
    lstCells.setTicker(new Ticker(Msg + " - " + dt.toString()));
  }

  public void commandAction(Command arg0, Displayable arg1) {
    if(arg0 == cmdExit) {
      try {
       destroyApp(false);
      } catch(MIDletStateChangeException e) {
        e.printStackTrace();
      }
      notifyDestroyed();
    }
  }

  public void itemStateChanged(Item item1) {
  }
}
Advertisements
This entry was posted in software and tagged , , , . Bookmark the permalink.