I would like to know if it is possible to use DBUS on Android using Java. From what I have been searching till now it appears like there isn't any DBUS programming support on Android. However, Bluetooth on Android uses DBUS. I would like to confirm if it is actually the case. If so, is there a possibility that DBUS would be supported in the future?

  • 2
    Have a look at stackoverflow.com/questions/1591164/… - short answer: you shouldn't do that. – Ulrich Dangel May 16 '12 at 2:18
  • @mru I did not get the reason. Could you explain it? If necessary we can change the Android OS before using. – nagavamsikrishna May 16 '12 at 3:00
  • The problem is it isn't guaranteed that dbus is available. If you control the platform you can ensure dbus is present. This will allow you to use the normal java dbus library – Ulrich Dangel May 16 '12 at 3:11
  • 2
  • 1
    @vski We have decided to use dbus anyway. But not by using java but using JNI to call dbus from native code. A new problem is, why are dbus headers not available in android-ndk? but dbus headers are in android source code. – nagavamsikrishna Jun 7 '12 at 8:31

As dbus is written in C, and Android supports (mostly) the Dalvik subset of Java its not surprising that dbus is not supported.

You can write C code for Android but unless you are a phone company (i.e. able to install OS level updates) there is no practical way to distribute your software.

  • 1
    This was wrong when it was written in 2014 and it's wrong now. You've been able to write C for Android for many years - according to Wikipedia, the NDK (used for C development) was released in 2009. – James Moore Dec 1 '17 at 21:52
  • Also, there exists many d-bus implementations and there is no reason why it needs to be written in C. – Lennart Rolland Sep 4 '18 at 13:41

You can enabled DBus on android using freedesktop.org library (at least private dBUS session). Only drawback you can not have properties published, so you need to do manipulations through interfaces. There was also few difficulties with signals, but I managed to get it working overriding few classes...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.