Cannot set volume on BlackBerry Playbook
Asked Answered
M

1

8

I have an issue in changing the volume of blackberry play book. First I am repacking my Android App to Palybook App. I need to change the volume of blackberry playbook using seekbar and in seeklistener I am setting the Audio manager volume. Here is the code:

audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

public void onStopTrackingTouch(SeekBar seekBar)
{
    // TODO Auto-generated method stub

}

public void onStartTrackingTouch(SeekBar seekBar) {
    // TODO Auto-generated method stub
}

public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) 
{

  // TODO Auto-generated method stub

   audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);

}

But when I run my app and change the seekbar, the volume of the system(Blackberry playbook) does not change.is it due to blackberry palybook security

Myrtia answered 22/9, 2012 at 10:18 Comment(0)
F
1

Are you sure you have added these permissions ?

<uses-permission android:name="android.permission.WRITE_SETTINGS" ></uses-permission>
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" ></uses-permission>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" ></uses-permission>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>

Also try this code

while(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) < progress) {
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI);

}

Firstclass answered 2/12, 2012 at 12:59 Comment(1)
Yes, it most likely is a permissions problem.Eglantine

© 2022 - 2024 — McMap. All rights reserved.