Frage

I've found it: http://gitorious.org/android-obex/pages/Home

I would like to call it from my Android app, does anyone know how to do?

War es hilfreich?

Lösung

The command line tools on the page you linked appear to be intended for use from the root adb shell available on developer phones, and may not be using a version of the bluetooth stack actually available on a given consumer phone. The use of stand alone executables is also not the "android way". Normally, you should build the code into a library to invoke via jni within your application's process, though if you need to run the code as root on a device where that is possible, then it will have to be run as a separate process (since you app itself cannot run as root).

If you want to play with this code on a rooted device, look for one of the many Stack Overflow answers on how to exec the su command and pipe the name and parameters of a command line program into it. This will be tricky to get working, unsupported, and will definitely not work on all devices.

If you want to do things the "android way" look into writing or adapting code so that it plugs into the current android bluetooth apis. That's likely to be java code, though you can check if there are appropriate native APIs or use the java ones from native code through jni.

Andere Tipps

It will be useful for you to read this:

Three of the core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents. Intent messaging is a facility for late run-time binding between components in the same or different applications.

Using Intents you can start activity or service, and

Intent objects passed to any of the broadcast methods (such as Context.sendBroadcast(), Context.sendOrderedBroadcast(), or Context.sendStickyBroadcast()) are delivered to all interested broadcast receivers. Many kinds of broadcasts originate in system code.

So everything you need is to determine what Intents can reсeive application you want to start, and to send specific broadcast intent. If application is installed, it will be launched, otherwise nothing will happen.

Hope it helps.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top