You Are Here:

Community: Developer Discussion Boards

#1 Old Bluetooth PushRegistry (6230) - 2005-03-08, 11:22

Join Date: Mar 2005
Posts: 13
rapajic
Offline
Registered User
I'm trying to create an application that start automatically on bluetooth incoming connection.

I've verified that the pushregistry functionality work with SMS event.
With btspp connection ConnectionNotFoundException was raised.

is it possible to use this functionality with 6230??
do you have a sample code using pushregistry on btspp?

thanks!
Reply With Quote

#2 Old PushRegistry and Bluetooth - 2005-03-22, 11:03

Join Date: Jan 2005
Posts: 27
hmauricio
Offline
Registered User
Hi!

I am also investigating Bluetooth and PushRegistry. As you do, I also want to start a MIDlet when a Bluetooth connection arrives. Until now I found this document in http://developers.sun.com/techtopics...icles/pushreg/

and in the topic "About Inbound Connections" you can read the following:

"Note that requesting an unsupported connection type will result in a ConnectionNotFoundException."

and also this

"The MIDP 2.0 specification doesn't mandate which inbound connection types must be available for push; that decision is left up to the platform vendors. Typically, though, we will have socket and datagrams available to us."

So it seams that Nokia doesn't have this feature available in all mobile phones, if any. I am working with Nokia 6600 but I haven't tried it yet.

Tell me if you have news.

Best regards,

Hugo Mauricio
Reply With Quote

#3 Old 2005-06-09, 16:37

Join Date: Mar 2005
Posts: 13
rapajic
Offline
Registered User
Hi,

PushRegistry feature is only available on series 60 2nd edition nokia mobile phone.

I'm trying to use it in 6680 mobile phone, push registration works fine, but now I have some problem to hang on incoming connection after auto activation.

If you have some news, don't hesitate to give me update.

thanks,
Raffaele
Reply With Quote

#4 Old 2005-07-01, 08:39

Join Date: Aug 2004
Posts: 47
ekhoo
Offline
Registered User
Hi, Im trying out the bluetooth push registry but im having some problems. Do u need to include the following permission in the jad file : javax.microedition.io.pushregistry.bluetooth.server?

I managed to register into the AMS but my midlet is not auto invoke when i have an incoming bluetooth connection. Do u know why? Thanks in advance.
Reply With Quote

#5 Old 2005-07-05, 15:44

Join Date: Mar 2005
Posts: 13
rapajic
Offline
Registered User
Yes, you have to add to API permissions the following one:

javax.microedition.io.PushRegistry

have you verified if the registration doesn't raise some exceptions?

what nokia phone model are you using?
Reply With Quote

#6 Old 2005-07-06, 06:02

Join Date: Aug 2004
Posts: 47
ekhoo
Offline
Registered User
I did and i use listconnection() to check if i have successfully registered to the AMS. I tried it on 6630 and 6680. But it is not working. Which model are u using?

Thanks inadvance
Reply With Quote

#7 Old 2005-07-06, 10:39

Join Date: Mar 2005
Posts: 13
rapajic
Offline
Registered User
Hi,

I'm using a 6680 phone like you.
I'm able to register midlet on AMS, but when midlet is auto-invoked it doesn't found incoming messages.

To register midlet I use the following code:

public void RegisterBTSPPconn()
{
//Register Service for Automatic Application Start (pushRegistry)
String connURL = "btspp://localhost:"+MYSERVICEUUID_UUID.toString()+";"+"name="+myServiceName+";authorize=false";
//Parent is a pointer to midlet main class
String midletClassName = Parent.getClass().getName();

try{
boolean resp = PushRegistry.unregisterConnection(connURL);
System.out.println("Unregister "+connURL+" = "+resp);
} catch (SecurityException e) {
System.out.println("Connection Registered by other MIDLET");
}

try{
PushRegistry.registerConnection(connURL,midletClassName,"*");
} catch (ClassNotFoundException cnf){
System.out.println("Not Found Class: "+cnf);
System.out.println("ClassName: "+midletClassName);
return;
} catch (IllegalArgumentException ex){
System.out.println("IllegalArgumentException: "+ex);
return;
} catch(IOException er){
System.out.println("IO exception: "+er);
return;
} catch (SecurityException ex){
System.out.println("SecurityException: "+ex);
return;
}
}


If the midlet accept pushregistry it ask you the question: "Allow application MyApp to start automatically when needed?"
Now if you turn off midlet using another device you can discover it.
If you try to connect to service dicovered your phone prompt you the same question that it is prompted to you during push-registration, midlet is auto-started, but I'm not able to read incoming messages.
I'm using the following code to intercept messages when midlet is auto-invoked:

public void run()
{
String[] connections = PushRegistry.listConnections(true);
NumConn = connections.length;

//Initialize BlueTooth Device
if(NumConn==0)
try{
btInit();
} catch (BluetoothStateException e){
System.out.println("InitBT: "+e);
}


if(connections != null && NumConn >0)
{
for (int i=0; i<NumConn; i++)
{
try{
scn = (StreamConnectionNotifier) Connector.open(connections[i]);

sc = scn.acceptAndOpen();
} catch (Exception e){
System.out.println("Excp: "+e;//+connections[i]);
return;
}

processConnection(sc);

try{
sc.close();
} catch (IOException e){}
try{
scn.close();
} catch (Exception e){}
}

}

try{
if(NumConn==0)
{
//Registers Service
String connURL = "btspp://localhost:"+MYSERVICEUUID_UUID.toString()+";"+"name="+myServiceName+";authorize=false;authenticate=false";

//Create a Server Connection Notifier
scn = (StreamConnectionNotifier) Connector.open(connURL);
}

isClosed = false;

//Accept a new Client Connection
while (!isClosed) {
try {
sc = scn.acceptAndOpen();
} catch (IOException e) {
System.out.println("Wrong Client or interrupted: "+e);
continue;
}

if (isClosed)
return;

Parent.AddDebugInfo("Manage Incoming Conn",1);
processConnection(sc);

sc.close();
}

} catch (Exception e){
System.out.println("Error Creating Service Record "+e,1);
}
}

I hope to be helpful for you.
If you discover how intercept incoming connection don't hesitate to say to me.

Thanks,
Raffaele
Reply With Quote

#8 Old Re: Bluetooth PushRegistry (6230) - 2005-09-01, 18:43

Join Date: Sep 2005
Posts: 4
mmacero
Offline
Registered User
Hello,

I have tried bluetooth pushregistry in 6230 but doesnt work, this phone does not support this feature

someone has a list of phones that support this?

thanks!!
Reply With Quote

#9 Old Re: Bluetooth PushRegistry (6230) - 2005-09-02, 07:45

Join Date: Mar 2005
Posts: 13
rapajic
Offline
Registered User
Bluetooth PushRegistry feature is supported by series 60 phone 2nd Edition FP2 or better.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia