I think you want to begin by looking at the tech tips and documentation. There is a tech-tip about this topic. Please search for the article.
simplest
private boolean isPushActivated()
{
String[] connections = PushRegistry.listConnections(true);
return ( connections != null && connections.length > 0 )
}
another example, sms push
private boolean isPushActivated()
{
String[] connections = PushRegistry.listConnections(true);
if ( connections != null )
{
for ( int i = 0; i < connections.length; i++ )
{
if ( connections[i].startsWith("sms") )
{
try
{
MessageConnection con = (MessageConnection) Connector.open(connections[i]);
Message message = con.receive();
if ( message instanceof TextMessage )
{
TextMessage textMessage = (TextMessage) message;
String text = textMessage.getPayloadText();
//do something with message
return true;
}
}
catch (InterruptedIOException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
return false;
}
Also, it is a good idea to use seperate threads for processing.