Development of Bluetooth-enabled Ubuntu Touch App



  • Dear all, I hope I'm asking this question in the right place.
    I'm trying to program a Ubuntu Touch app which needs to use the Bluetooth-capabilities of the Nexus 5 phone (currently with UT OTA-8).

    I did not find any information on bluetooth-development or any suitable example for Ubuntu Touch. Did I miss something?

    So, I started out with the clickable template "main-cpp - C++/QML App (built using Cmake with a main.cpp)". I then downloaded the QT5 Example Project BTScanner and integrated it in the clickable-template.

    Good news: My project compiles without error.
    Bad news: When I run the app with "clickable launch", this error ends up in the log

    Loading module: 'libubuntu_application_api_touch_mirclient.so.3.0.0'
    Cannot find a running Bluez. Please check the Bluez installtion
    

    Does anyone have a hint what I am doing wrong? Is Bluetooth supposed to work a all? Is there a permission problem?

    Thank you! Best regards, Nils



  • @nilsl while waiting for someone who really knows about development 😅 have you seen http://docs.ubports.com/en/latest/appdev/platform/apparmor.html#bluetooth?



  • Remember that Apps do not have any access to hardware directly. This is all contained and sealed and probably you could try to run the App as unconfined, but that removes all protections.
    BR



  • @advocatux Thanks. Yes, I was aware I have to add the "bluetooth" policy group to the .apparmor-file:

    {
        "policy_groups": ["bluetooth"],
        "policy_version": 16.04
    }
    

    However, I probably got confused: It seems that the AppArmor-configuration only gets adopted when the version number in manifest.json is increased (I don't know if this bug report is related).

    Anyway, with this .apparmor-file and after increasing the version in manifest.json, the error ("Cannot find a running Bluez") is gone.

    @Flohack
    I this case, adding

    "template": "unconfined"
    

    to the .apparmor-file did not seem to be necessary to get Bluetooth-access. Thanks for the hint about running apps as unconfined anyway.


Log in to reply