1. Download our Official Android App: Forums for Android!

Mobile App sound not working on a my device

Discussion in 'Android Development' started by Sriram Shanmugasundaram, Aug 24, 2017.

  1. Sriram Shanmugasundaram

    Thread Starter
    Rank:
    None
    Points:
    26
    Posts:
    10
    Joined:
    Aug 24, 2017

    Aug 24, 2017
    10
    1
    26
    Hi,
    I ve developed an app which triggers the sound in the device. The sound is coming fine in other devices except "Micromax Bharat 2" which has Marshmallow OS.

    How to solve this issue.?
    Help me please.
     

    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,849
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,849
    11,457
    1,988
    Male
    Software developer
    South West of England
    A couple of things you could try:-

    - Connect the real device to your computer and run your run your app on it from Android Studio. Do you see any errors?
    - If you don't have the physical device, try running your app on an emulated device running the same version of Android. Does it work? Do you get any errors?

    (Moved thread to Android Development forum)
     
  3. Sriram Shanmugasundaram

    Thread Starter
    Rank:
    None
    Points:
    26
    Posts:
    10
    Joined:
    Aug 24, 2017

    Aug 24, 2017
    10
    1
    26

    Thanks for your reply.
    I dont see any errors.Just the sound is not coming.
    But it is coming in other devices except the one I have mentioned.
     
  4. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,849
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,849
    11,457
    1,988
    Male
    Software developer
    South West of England
    It might help to see the code you are using.
     
  5. Sriram Shanmugasundaram

    Thread Starter
    Rank:
    None
    Points:
    26
    Posts:
    10
    Joined:
    Aug 24, 2017

    Aug 24, 2017
    10
    1
    26
    Code (Text):
    1.  
    2. public static  void play(int sound, int number){
    3.    AudioManager am = (AudioManager)Util.context.getSystemService(Util.context.AUDIO_SERVICE);
    4. //AlermManager
    5.        float audioMaxVolume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    6.        
    7.        //Audio Manager
    8.         float audioCurrentVolume = am.getStreamVolume(AudioManager.STREAM_MUSIC);
    9.         float volumnRatio = audioCurrentVolume/audioMaxVolume;
    10.         sp.play(
    11.             suondMap.get(sound), //Id
    12.             audioCurrentVolume,
    13.             audioCurrentVolume,
    14.             1,
    15.             number,
    16.             1);
    17.     }
    18.  
     
    #5 Sriram Shanmugasundaram, Aug 24, 2017
    Last edited by a moderator: Aug 24, 2017
  6. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,849
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,849
    11,457
    1,988
    Male
    Software developer
    South West of England
    So what piece of code calls the play() method? What class is it in?
    Have you verified that this method gets called by setting a breakpoint here?
    Have you stepped though the code to verify proper code execution?
     
  7. Sriram Shanmugasundaram

    Thread Starter
    Rank:
    None
    Points:
    26
    Posts:
    10
    Joined:
    Aug 24, 2017

    Aug 24, 2017
    10
    1
    26
    I am calling this method in Main Activity.
    Util.play(1, 10);

    Util is the class I am calling.
     
    sweetndreemy73 likes this.

Share This Page

Loading...