Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [solved] Android volume control
Forum Updated to NodeBB v4.3 + New Features

[solved] Android volume control

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 3.1k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    habamax
    wrote on 4 Jul 2014, 11:23 last edited by
    #1

    Is it possible to change system volume on android?
    Like in java:
    @
    AudioManager mgr=null;

    mgr=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    mgr.setStreamVolume(AudioManager.STREAM_MUSIC, 0, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
    @

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 4 Jul 2014, 11:40 last edited by
      #2

      Hi,

      AFAIK, there's no inbuilt way in Qt. You will have to rely on the Android API's. For it you will need to call Android API's from Qt.
      Have a look at "qtandroidextras":http://qt-project.org/doc/qt-5/qtandroidextras-module.html and "qandroidjniobject":http://qt-project.org/doc/qt-5/qandroidjniobject.html. Also an example "here":http://qt-project.org/doc/qt-5/qtandroidextras-notification-example.html

      157

      1 Reply Last reply
      0
      • H Offline
        H Offline
        habamax
        wrote on 4 Jul 2014, 12:01 last edited by
        #3

        [quote author="p3c0" date="1404474027"]Hi, AFAIK, there's no inbuilt way in Qt. You will have to rely on the Android API's. For it you will need to call Android API's from Qt. Have a look at "qtandroidextras":http://qt-project.org/doc/qt-5/qtandroidextras-module.html and "qandroidjniobject":http://qt-project.org/doc/qt-5/qandroidjniobject.html. Also an example "here":http://qt-project.org/doc/qt-5/qtandroidextras-notification-example.html[/quote]

        Thx!

        I will have a closer look into it.

        I wonder is there a function in android ndk I could wrap as a qml component and use it in qml to adjust system volume.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          p3c0
          Moderators
          wrote on 4 Jul 2014, 12:07 last edited by
          #4

          I don't think so android would allow it directly unless the system is rooted and more if a such a C function exists.

          157

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gianluca
            wrote on 6 Jul 2014, 07:43 last edited by
            #5

            You can easily use QtAndroidExtras to call from C++ your java method, and then you can wrap the QtAndroidExtras into a QObject and export it to QML side.
            I did it for other stuffs and works great.

            [quote author="habamax" date="1404475287"][quote author="p3c0" date="1404474027"]Hi, AFAIK, there's no inbuilt way in Qt. You will have to rely on the Android API's. For it you will need to call Android API's from Qt. Have a look at "qtandroidextras":http://qt-project.org/doc/qt-5/qtandroidextras-module.html and "qandroidjniobject":http://qt-project.org/doc/qt-5/qandroidjniobject.html. Also an example "here":http://qt-project.org/doc/qt-5/qtandroidextras-notification-example.html[/quote]

            Thx!

            I will have a closer look into it.

            I wonder is there a function in android ndk I could wrap as a qml component and use it in qml to adjust system volume.

            [/quote]

            1 Reply Last reply
            0

            2/5

            4 Jul 2014, 11:40

            • Login

            • Login or register to search.
            2 out of 5
            • First post
              2/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved