Logic code behaves differently on android and iOS

#1

So I have this code to play an audio and redirect depending on an argument passed through the function.
In the case of iOS is works totally fine. But in the case of android it does not do anything. The code block doesn’t work at all.

  async redirect(loc) {
    const soundObject = new Expo.Audio.Sound();
    if(this.state.mute === false){
      try {
        await soundObject.loadAsync(loadedClickSound);
        await soundObject.replayAsync();

      } catch (error) {
      }
    }
    switch(loc){
      case "help": {
        Actions.help();
        break;
      }
      case "score": {
        Actions.scorePage();
        break;
      }
      case "play": {
        if(this.state.mute === false){
        soundObject2.unloadAsync();
        }
        Actions.loading({ soundObject });
        break;
      }
      case "selectPlay": {
        Actions.select({ soundObject2 });
        break;
      }
      default: {
        Actions.trophies();
        break;
      }
    }
  }

#2

Hi @amansahil,

Would you please give a little more info about which block isn’t working? Ideally, it would be great if there were a snack we could reference (http://snack.expo.io) which shows the behavior failing on android but working on iOS so that we can dig in.

Thanks!
Jason

closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.