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?
-
2Have a look at stackoverflow.com/questions/1591164/… - short answer: you shouldn't do that.Ulrich Dangel– Ulrich Dangel2012年05月16日 02:18:24 +00:00Commented 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.user23770– user237702012年05月16日 03:00:19 +00:00Commented 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 libraryUlrich Dangel– Ulrich Dangel2012年05月16日 03:11:26 +00:00Commented May 16, 2012 at 3:11
-
2freedesktop.org/wiki/Software/DBusBindingsUlrich Dangel– Ulrich Dangel2012年05月16日 13:54:12 +00:00Commented 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.user23770– user237702012年06月07日 08:31:01 +00:00Commented Jun 7, 2012 at 8:31
2 Answers 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.
-
5This 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– James Moore2017年12月01日 21:52:44 +00:00Commented Dec 1, 2017 at 21:52
-
1Also, there exists many d-bus implementations and there is no reason why it needs to be written in C.Mr. Developerdude– Mr. Developerdude2018年09月04日 13:41:58 +00:00Commented Sep 4, 2018 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...