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. Set android sound stream to STREAM_MUSIC
Forum Update on Monday, May 27th 2025

Set android sound stream to STREAM_MUSIC

Scheduled Pinned Locked Moved Solved Mobile and Embedded
androidsoundndk
2 Posts 1 Posters 1.1k Views
  • 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.
  • X Offline
    X Offline
    Xicor
    wrote on 4 Feb 2016, 14:03 last edited by
    #1

    by default it seems that my app's sound stream gets set to notification, meaning when i hit the volume rocker, it changes the notification sound volume. This unfortunately means that right now if i want to unmute the volume for media(which my app uses), i have to go to a different app, hit the volume rocker and then go back.

    i looked up how to set the output stream using java and the sdk, but how do i do it using ndk?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xicor
      wrote on 4 Feb 2016, 17:55 last edited by
      #2

      this works. if you use jactivity.callObjectMethod instead of jactivity.callMethod it just crashes.

      QAndroidJniObject jactivity=QtAndroid::androidActivity();
      if(jactivity.isValid())
      jactivity.callMethod<void>("setVolumeControlStream","(I)V",3);

      1 Reply Last reply
      0

      1/2

      4 Feb 2016, 14:03

      • Login

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