Home  | My Account  |  Membership
WorldDeveloper.org
Forum Details
Topics
Posts
Categories
 
577 member(s)
718,905 hit(s)
14 categories
51 topics
26 messages
0 online
Forums: J2ME Development
J2ME: How to tell if application was Push activated
hostj2me
43 topic(s)
23 post(s)

May 29, 2007 2:22 PM


private boolean isPushActivated()
{
String[] connections = PushRegistry.listConnections(true);
return ( connections != null && connections.length > 0 )
}



hostj2me
43 topic(s)
23 post(s)

May 29, 2007 2:22 PM

another example


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;
}


©2008 WorldDeveloper.org - PO Box 310575 Miami, FL 33231

WorldDeveloper.org is a managed social network for application developers around the world.