Reputation: 47
could any one please help us to retrieve data from incoming message in blackberry 8520 and to store the retrived data in to the shared preferences
Upvotes: 0
Views: 161
Reputation: 1471
We can use the listener to listen the messages before coming into the inbox. But you cannot read the messages that are already received. You can use the below sample code:
try{
dc = (DatagramConnection) Connector.open("sms://");
for(;;){
if(stop){
return;
}
Datagram d = dc.newDatagram(dc.getMaximumLength());
dc.receive(d);
String address = new String(d.getAddress());
String msg = new String(d.getData());
MyScreen.update(msg,address);
}
}catch(Exception e){
System.err.println(e.toString());
}
You can find more information BlackBerry_Application_Developer_Guide_Volume_1 book
Upvotes: 1