how to know if push started MIDlet

Hi guysSorry if I am sending the previously posted thread.How can I know if the MIDlet was started manually or by pushed message?cheers
[163 byte] By [gerekbolsaa] at [2007-11-27 5:07:13]
# 1
> How can I know if the MIDlet was started manually or> by pushed message?do your own tests...start it manually, see what's going on and start it with pushed message and see what's going.note the differences if there is some difference...
suparenoa at 2007-7-12 10:26:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

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.

rashidmayesa at 2007-7-12 10:26:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...