BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 05-16-2007, 06:12 AM   #1 (permalink)
New Member
Join Date: May 2007
Model: 8707
Carrier: vodafone
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default pushregistry

Please Login to Remove!

I am trying to make a application that will autostart on incoming sms:s.
I looked at the "How_To_-_Create_an_auto-start_MIDlet_using_the_PushRegistry" but I use the UIapplication not a MIDlet .
Can this be done?

Old 05-16-2007, 11:57 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
Skipper_Joe's Avatar
Join Date: Jan 2007
Location: Kharkov, Ukraine
Model: 8300
Carrier: N/A
Posts: 237
Post Thanks: 0
Thanked 0 Times in 0 Posts

It looks like you can do it via javax.wireless.messaging package: register your your UiApplication to start on device power up, implement and register MessageListener in the beginning.

I didn't do it myself, but just a suggestion.
Old 06-15-2007, 10:44 AM   #3 (permalink)
New Member
Join Date: Jun 2007
Model: 8703e
Carrier: Iusacell
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Red face PushRegistraty on 8703e

Hi we try to make the aplication start up whit a SMS, we now that posible with the PushRegistry capability, uor JAD file is the current:

Manifest-Version: 1.0
RIM-COD-Module-Name: PushRegistryApp
RIM-COD-Module-Dependencies: net_rim_cldc
MIDlet-Jar-Size: 4637
MIDlet-1: MIDlet PushRegistryApp,,PushRegistryApp
RIM-COD-Creation-Time: 1181920336
MIDlet-Jar-URL: PushRegistryApp.jar
RIM-COD-URL: PushRegistryApp.cod
RIM-COD-SHA1: 36 c5 2f fc c2 b4 f1 55 a6 9f ef 73 2b 9c bc bd 44 68 f0 dc
RIM-COD-Size: 3984
MicroEdition-Configuration: CLDC-1.1
MIDlet-Push-1: sms://:5012,PushRegistryApp, *
MIDlet-Permissions:,, javax.wireless.messaging.sms.receive,javax.wireles s.messaging.sms.send
MIDlet-Version: 0.9
MIDlet-Name: PushRegistryApp
MIDlet-Vendor: Research In Motion Ltd.
MicroEdition-Profile: MIDP-2.0
RIM-MIDlet-Flags-1: 0

and our JAVA souce is:


//package test.javax.microedition.midlet;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import java.util.*;
import javax.wireless.messaging.*;
public final class PushRegistryApp extends MIDlet

//The data we expect to receive.
private static final String TEST_DATA = "This is just a test";
private Display theDisplay;
private Form theForm;
private StringItem messages;
private MessageConnection mc;

public PushRegistryApp()

//Signals the MIDlet that it has entered the Active state.
public void startApp()
//Get the display object for this MIDlet.
theDisplay = Display.getDisplay(this);

//Instantiate the form.
theForm = new Form("PushRegistryApp");

//Istantiate the StringItem.
messages = new StringItem("", "starting...");

//Add the StringItem to the form.

//Open the SMS connection on port 5678.
mc = (MessageConnection)"sms://:5012");
catch(IOException ioe){
System.out.println("Failed to open connection: "
+ ioe.toString());
//Create and start a new WorkerThread.
Thread t = new WorkerThread();


private class WorkerThread extends Thread
public void run() {
//Open the connection.
//Incoming data should be waiting.
String connection = getAppProperty("MIDlet-Push-1");

//The property is '<uri>, <midlet>, <filter>'
//so get just the uri.
connection = connection.substring(0, connection.indexOf(','));

//Get all connections registered with the PushRegistry
//for the current MIDlet suite.
String[] connectionsWithData =

//Test all connections to locate the one matching "sms://5678".
for ( int i = connectionsWithData.length - 1; i >= 0; --i)
if ( connectionsWithData[i].equals(connection) )
//Found the matching connection.
//Fetch the incoming data.

//Shut down to wait for data.

//Fetches the incoming data.
private void fetchData(String connection)
//Open the connection.
Connection c =;

if ( c instanceof StreamConnectionNotifier )
//Open an InputStream.
StreamConnectionNotifier scn = (StreamConnectionNotifier)c;
StreamConnection sc = scn.acceptAndOpen();
InputStream input = sc.openInputStream();

//Extract the data from the InputStream.
StringBuffer sb = new StringBuffer();
byte[] data = new byte[256];
int chunk = 0;
while ( -1 != (chunk = )
sb.append(new String(data, 0, chunk));

//Close the InputStream and StreamConnection.

String s = sb.toString();

//Test the data for validity.
//If invalid an exception is thrown.
"Failed to receive proper string: " + s);

//Display the received data.
message("Received: " + sb.toString());
} catch (IOException e)


//Display a String message to the user.
private void message(String msg)
//Display the message in the StringItem.
messages.setText(messages.getText() + "\n" + msg);

//Signals the MIDlet to stop and enter the Pause state.
public void pauseApp()

//Signals the MIDlet to terminate and enter the Destroyed state.
//Unconditional when set to true. The MIDlet must cleanup and release
//all resources.
//Otherwise, the MIDlet may throw a MIDletStateChangeException to
//indicate it does not want to be destroyed at this time.
public void destroyApp(boolean unconditional)
//Close the connection.
catch(IOException ioe)

//Throws an IllegalStateException with the supplied error message.
final class Assert
private Assert()

static public void assertTrue(boolean exp, String failmsg)
if ( !exp) throw new IllegalStateException(failmsg);

We send the current sms : //wma:5012 message test......

But the aplication didint start Up ....

Can any Body help US..... please because the BlackBerry Suport cant.....

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.