8

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?

Greenonline
1452 gold badges2 silver badges11 bronze badges
asked May 16, 2012 at 1:07
7
  • 2
    Have a look at stackoverflow.com/questions/1591164/… - short answer: you shouldn't do that. Commented May 16, 2012 at 2:18
  • @mru I did not get the reason. Could you explain it? If necessary we can change the Android OS before using. Commented May 16, 2012 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 Commented May 16, 2012 at 3:11
  • 2
    freedesktop.org/wiki/Software/DBusBindings Commented May 16, 2012 at 13:54
  • 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. Commented Jun 7, 2012 at 8:31

2 Answers 2

2

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.

answered Aug 15, 2014 at 7:32
2
  • 5
    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. Commented Dec 1, 2017 at 21:52
  • 1
    Also, there exists many d-bus implementations and there is no reason why it needs to be written in C. Commented Sep 4, 2018 at 13:41
0

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...

answered Jun 26, 2019 at 9:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.