Actually this works if I remove the <data /> tags from the intent- filter. So I can send and receive data sms and sms. Is there anyway to know which port a data SMS came in on? I have tried specifying a port when using this method: SMSManager.sendDataMessage(String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent). Specifying a port seems to do nothing, or if it does I don't see how to extract the port number or define a specific broadcast receiver for this port.
On Feb 16, 4:56 pm, thesquib <[email protected]> wrote: > Is there already functionality similar to the push registry or > wireless messaging API in J2ME implemented in Android? Or at least > plans to do so? I have been looking at this issue for a while, because > in a corporate environment it is essential to be able to push > information out, or trigger actions via SMS or other connections. > > I have successfully sent an SMS between emulator instances, and > successfully received an SMS by using a BroadcastReceiver on another > emulator instance. I have also been able to use > SmsManager.sendDataMessage() to send a data message to a port on > another emulator instance, but in this case the BroadcastReceiver is > never triggered. This seems to be the closest the API's get to what > I'm looking for, but I can't get it to work. Any info would be greatly > appreciated. > > I attempted to receive a data message by adding these lines to the > manifest: > <receiver android:name=".DataSMSReceiver" > android:enabled="true"> > <intent-filter> > <action > android:name="android.intent.action.DATA_SMS_RECEIVED" /> > <data android:scheme="sms"/> > <data android:host="localhost"/> > <data android:port="3492"/> > </intent-filter> > </receiver> > And the onReceive method in the DataSMSReceiver is never called. It > *is* called if I get an SMS. I have tried these permissions: > <uses-permission android:name="android.permission.RECEIVE_SMS" /> > <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" /> > <uses-permission android:name="android.permission.READ_SMS" /> > <uses-permission android:name="android.permission.RECEIVE_MMS" /> > > I sent the data message from another activity using this code (5554 > happened to be the port the destination emulator was running on): > SmsManager mgr = SmsManager.getDefault(); > short port = 3492; > String mesg = "Test data message"; > mgr.sendDataMessage("5554",null,port,mesg.getBytes(),null,null); > > This was received by the other emulator, it just didn't trigger the > broadcast receiver. Is there something else that needs to be done to > achieve this? > > Thanks very much. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

