| Reply | « Previous Thread | Next Thread » |
|
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! |
|
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 |
|
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 |
|
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. |
|
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? |
|
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 |
|
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 |
|
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!! |
|
Bluetooth PushRegistry feature is supported by series 60 phone 2nd Edition FP2 or better.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|