Navigation

    UBports Robot Logo

    UBports Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Development of Bluetooth-enabled Ubuntu Touch App

    App Development
    3
    4
    242
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nilsl last edited by

      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

      advocatux 1 Reply Last reply Reply Quote 0
      • advocatux
        advocatux @nilsl last edited by

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

        N 1 Reply Last reply Reply Quote 1
        • Flohack
          Flohack last edited by

          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

          1 Reply Last reply Reply Quote 1
          • N
            nilsl @advocatux last edited by nilsl

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

            1 Reply Last reply Reply Quote 1
            • First post
              Last post