Samsung Galaxy Mini Ringing Alarm Sound Problem
When i was developing a small application that was using the default sounds with setting the volume of tone, used AlarmManager classAudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
int maxVolumeForDevice= audioManager .getStreamMaxVolume(AudioManager.STREAM_RING);
audioManager.setStreamVolume(AudioManager.STREAM_RING, maxVolumeForDevice AudioManager.FLAG_ALLOW_RINGER_MODES);
Firstly get Audiomanager and get the devices max volume (because all devices have different volume) then setting was the target but one of the android device i got good result but in the another device i could not get the good result if the phone was on silent state the volume was not changing so i used adjust function instead of set. That function was supporting some other attributes too such as raising the volume etc...
audioManager.adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_RAISE, AudioManager.FLAG_ALLOW_RINGER_MODES);
Then you should use RingtoneManager class for the sound file and then you should get the file from the specified path and then play the soud.
For the example of this small program is : https://play.google.com/store/apps/details?id=com.find.lostphone&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5maW5kLmxvc3RwaG9uZSJd
No comments:
Post a Comment