Android Development

QR-Code, IBR Apps in Google Play

Permission to use the DTN service

In order to use the DTN service to register or send/receive bundles you need to request the permission for this in your AndroidManifest?.xml.

    <uses-permission android:name="de.tubs.ibr.dtn.permission.DTN_COMMUNICATION"/>

Listed in the DTN apps

To list your app in the list of DTN applications inside of IBR-DTN you just need to declare the Activity with the intent "de.tubs.ibr.dtn.intent.DTNAPP".

<activity android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:name=".MainActivity">
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    <intent-filter >
        <action android:name="de.tubs.ibr.dtn.intent.DTNAPP" />
        <category android:name="android.intent.category.DEFAULT" />


  • de.tubs.ibr.dtn.intent.STATE: Signals the state of the daemon to the application. With this you can wake-up your app if the daemon is switched on.
  • de.tubs.ibr.dtn.intent.REGISTRATION: The REGISTRATION intent is fired on a successful registration of your application.
  • de.tubs.ibr.dtn.intent.RECEIVE: Each time a bundle is ready to receive by your app, the RECEIVE intent is called.
  • de.tubs.ibr.dtn.intent.STATUS_REPORT: If a status report has been received for a bundle, this intent will summarize the report.

To register to one or more of these intents use an IntentReceiver? as shown in this definition of the AndroidManifest?.xml.

<receiver android:enabled="true" android:name=".service.EventReceiver" android:exported="true" android:permission="de.tubs.ibr.dtn.permission.DTN_SERVER">
        <action android:name="de.tubs.ibr.dtn.intent.STATE" />
        <category android:name="android.intent.category.DEFAULT" />
        <action android:name="de.tubs.ibr.dtn.intent.REGISTRATION" />
        <!-- IMPORTANT: The category has to be the package name of the app! -->
        <category android:name="" />
        <action android:name="de.tubs.ibr.dtn.intent.RECEIVE" />
        <!-- IMPORTANT: The category has to be the package name of the app! -->
        <category android:name="" />

Example Application

An example app using the DTN service for Android is provided in the GIT repository.

Work with the emulator

Since the emulator is not able to provide a wifi device, we need to forward the listening port (4556) of the daemon to outside of the emulator. First, we need to configure the IBR-DTN daemon on the mobile phone to listen on the local loopback device (lo). Next we can configure the adb daemon to forward the local port inside the emulator to a port of the host machine.

$ ./platform-tools/adb forward tcp:4559 tcp:4556

Now the daemon is reachable on port localhost:4559. Test this with telnet! You should get some output like this.

$ telnet localhost 4559
Trying ::1...
Connected to localhost.
Escape character is '^]'.

Connecting local dtnd and the emulator

To connect a locally running DTN daemon on the PC with the IBR-DTN Daemon running in the emulator together we need to specify a static route. Just add these four lines to the IBR-DTN configuration configuration on the PC and restart the daemon:

static1_uri = dtn://emulator01.dtn
static1_address =
static1_port = 4559
static1_proto = tcp

The value of the parameter static1_uri should match the name of the daemon.

Last modified 6 years ago Last modified on 12.08.2014 09:38:18

Attachments (1)

Download all attachments as: .zip