Home setStreamVolume on Android 7
Reply: 0

setStreamVolume on Android 7

user1164
1#
user1164 Published in April 22, 2018, 5:00 am

I have this code to set all incoming calls to max volume:

var
  RingingManager: JAudioManager;
begin
  RingingManager:= TJAudioManager.Wrap((TAndroidHelper.Context.getSystemService(TJContext.JavaClass.AUDIO_SERVICE) as ILocalObject).GetObjectID); 

  if Assigned(FRingingManager) then
    begin
      try
        FRingingManager.setRingerMode(TJAudioManager.JavaClass.RINGER_MODE_NORMAL);
        Sleep(2000);
        RingingManager.setStreamVolume(TJAudioManager.JavaClass.STREAM_RING, FRingingManager.getStreamMaxVolume(TJAudioManager.JavaClass.STREAM_RING), 0);
      finally
        RingingManager:= nil;
      end;
    end;
end;

On device SAMSUNG SM-A510 (Android 7.0) this code works well. Ringing is increased from 0 to max, from vibration (only) to max and from silent mode to max.

On device SAMSUNG SM-A520F (Android 7.0) this code does not work. The only thing that works properly is ringing incrasing from 1 to max. Nothing else works.

Do not know where the bug is?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297361 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO