Audio dont working my file


#1

Hi,please help me.
First file is true run.but second file dont work.

FIRST FILE

export class  ..................{


	constructor(public platform:Platform,public alertCtrl:AlertController,private nativeAudio: NativeAudio,public navCtrl: NavController, public navParams: NavParams,public storage: Storage) {
		platform.registerBackButtonAction(()=>{   
        let confirm = this.alertCtrl.create({
      title: 'EXİT?',
      message: 'Do you agree exit?',
      buttons: [
        {
          text: 'No',
          handler: () => {
            console.log('Disagree clicked');
          }
        },
        {
          text: 'Yes',
          handler: () => {
            console.log('Agree clicked');
            this.platform.exitApp();
          }
        }
      ]
    });
	}

	ionViewWillEnter(){
		this.storage.get('gender').then((data)=>{
			if(data==".............){
				..................;}
			else{		
				..................;}});		
	}
}

SECOND FILE

export class .................. {


  	constructor(public platform:Platform,public alertCtrl:AlertController,private nativeAudio: NativeAudio,public storage: Storage,public navCtrl: NavController, public navParams: NavParams) {
        platform.registerBackButtonAction(()=>{   
let confirm = this.alertCtrl.create({
      title: 'EXİT?',
      message: 'Do you agree exit?',
      buttons: [
        {
          text: 'No',
          handler: () => {
            console.log('Disagree clicked');
          }
        },
        {
          text: 'Yes',
          handler: () => {
            console.log('Agree clicked');
            this.platform.exitApp();
          }
        }
      ]
    });}


    ionViewWillEnter(){
		if(this.no==...){
			..................;
		}
		else if(this.no==...){
			..................;
		}
		else if(this.no==...){
			..................);
		}	
        }


  }

#2

It looks to me like you have a race condition. Somehow you must ensure that the merhaba property is set before you attempt to use it. I think the clearest way to do that is to make it not a raw string, but a Promise<string>.


#3

First file is OK.its run
But second file dont work


#4

I know you said that. I do not believe you will see any consistent behavior from either page as they are written.


#5

So I’m only changed string type ,promise <string>.is it correct?And only merhaba string or other audio file type?


#7
ionViewWillEnter(){

	getFrom():Promise<string>{
		return this.storage.get('gender').then((data)=>{
			if(data=="....."){
				return Promise.resolve("..................");}
			else{		
				return Promise.resolve("..................");}
	}}}


Dont work.Please help…


#8