import java.awt.*;//graphics i.e. print to screen
public class test extends java.applet.Applet
{
public void init()
{
resize(50,5000);
}
public void paint(Graphics g)
{
g.drawString("FRED IMEI: "+ new test().getIMEI(),10,10);
g.drawString("FRED IMSI: "+ new test().getIMSI(),50,50);
}
public String getIMEI() {
String out = "";
try {
out = System.getProperty("com.imei");
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("phone.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.sonyericsson.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.motorola.IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.samsung.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.siemens.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("imei");
}
} catch (Exception e) {
return out == null ? "" : out;
}
return out == null ? "" : out;
}
//code for getting IMSI of the phone
public String getIMSI() {
String out = "";
try {
out = System.getProperty("IMSI");
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("phone.imsi");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.mobinfo.IMSI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.imsi");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("IMSI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("imsi");
}
} catch (Exception e) {
return out == null ? "" : out;
}
return out == null ? "" : out;
}
}
/*
and here goes your html page contents (asp.net or any other)
<html>
<head>
<title> A Java Applet Program </title>
</head>
<body>
<form id="form1" runat="server">
Here is the output of my program:<br />
<applet code="test.class" width="150" height="25" />
</form>
</body>
</html>
and that all
*/
public class test extends java.applet.Applet
{
public void init()
{
resize(50,5000);
}
public void paint(Graphics g)
{
g.drawString("FRED IMEI: "+ new test().getIMEI(),10,10);
g.drawString("FRED IMSI: "+ new test().getIMSI(),50,50);
}
public String getIMEI() {
String out = "";
try {
out = System.getProperty("com.imei");
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("phone.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.sonyericsson.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.motorola.IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.samsung.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.siemens.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("imei");
}
} catch (Exception e) {
return out == null ? "" : out;
}
return out == null ? "" : out;
}
//code for getting IMSI of the phone
public String getIMSI() {
String out = "";
try {
out = System.getProperty("IMSI");
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("phone.imsi");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.mobinfo.IMSI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.imsi");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("IMSI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("imsi");
}
} catch (Exception e) {
return out == null ? "" : out;
}
return out == null ? "" : out;
}
}
/*
and here goes your html page contents (asp.net or any other)
<html>
<head>
<title> A Java Applet Program </title>
</head>
<body>
<form id="form1" runat="server">
Here is the output of my program:<br />
<applet code="test.class" width="150" height="25" />
</form>
</body>
</html>
and that all
*/
To compile
ReplyDelete1. Install java sdk
2. save the source code eg c:\test.java
3. compile in command prompt
i.e cmd ==> enter ==> type "cd path of java file"
e.g CD "D:\Program Files\Java\jdk1.6.0_20\bin"
press enter
4. now, compile your java file
i.e. on command prompt, type "javac c:\test.java"
5. If there are no errors, a new file is created i.e. test.class
Copy this file (tesst.class) to the location of your html file
6. thats all, now run your html file
7. expected results: blank
8. reason: do not test from your server, test from a mobile device (mobile browser/smart phone)
9. DISCLAIMER: MAY NOT WORK ON ALL PHONES
HOPE THAT HELPS YOU OUT THERE
If these instructions do not work, consider CHANGING YOUR PHONE, A.S.A.P.
ReplyDelete