mercredi 20 mai 2015

Uri for intent data

I'm trying to write an app used for testing SMS receivers. Currently I am a bit stuck on the use case of receiving a Data SMS to a specific port. I have no trouble sending a real Data SMS but I would like to just simulate it by spoofing the broadcast event.

Now to where I am stuck: I need to set the intent data in code.

In XML it looks like this

<data
  android:scheme="sms"
  android:host="*"
  android:port="12345" />

The intent filter it hast to match is constructed like this

intentFilter.addDataScheme("sms");
intentFilter.addDataAuthority("*", PORT);

My question is how do I create the correct URI from the above XML?

Aucun commentaire:

Enregistrer un commentaire