Problem
It is not possible read SIM (MSISDN) using j2me
That means there is no guarantee of user(In secure application)
In is not possible to detect change of SIM card by j2me application
Reason
You can copy an install j2me application more than one mobile phone.
If you provide license key it is possible to activate both j2me applications
W@P or GPRS connection not provide any user specific information while access internet.
Solution
Messages can be received via SMS by user defined port. Those messages are not receive to Inbox. However we can read those messages by j2me. Since SMS receive (bounded) to MSISDN (SIM) we can guarantee the program activation is done for valid (authenticated mobile) user.
Drawback
send SMS in each time of authentication may costly.
To receiver SMS
1 Application must be in running state.
2 Or we can start application on SMS arrived.
for 2nd option application manager(mobile phone) ask to confirm run application and we must accept. Otherwise massage will discard.
NOTE: don't send any valuable data over plane text SMS. It should use private key public key encryption or some other method to make it secure.
/* Create Connection */
public void connectSMSServer() {
try {
messageConnection messageConnection = (MessageConnection)Connector.open("sms://:" + 7777);
//we specify port number 7777 t0 receiving port
messageConnection.setMessageListener(this);
} catch (Exception e) { }
}
/* Recieve SMSmessage */
public void receiveSMSMessage() {
try {
Message message = messageConnection.receive();
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage)message;
} else {
//process the message an do nessosory operations here...
}
} catch (Exception e) { }
}
more sample codes will come soon with next edit
who sends message to specific port number
ReplyDelete