1 year ago

#129815

test-img

NITCHEU N. Legrand

Ionic CallNumber.callNumber() promise return "Ok" instead of the ussdResponse

I'am on a Ionic React project an will like to run USSD code and process the response in other to automate some process. I first use the react-native-ussd npm package but it sames to not be compatible with ionic react projet (and instead react-native project). Therefore, I got ionic call-number as a functional package for this but I dont know how to get the ussd response to process it. The callNumber() promise function return "Ok" instead of the ussd response. Can some one help me to resolve this issue? Thank in avance for your participation.

  async handleSubmitForm(e:any) {
    e.preventDefault();
    this.setState({inProccess: true});
    let granted = await AndroidPermissions.checkPermission(AndroidPermissions.PERMISSION.CALL_PHONE)
    .then(
      isGranted => {
        return true;
      },
      notGranted => {
        return false;
      }
    )
    .catch(raison => {
      return false;
    });
    if (granted) {
      let res = await CallNumber.callNumber(this.state.ussdCode, false);
      prompt(this.state.ussdResponse);
      alert(JSON.stringify(res));
    }
    else {
      alert( "Vous n'avez pas donné les autorisations requises. Vous ne pouvez pas utiliser l'application." );
    }
    this.setState({inProccess: false});
  }

reactjs

typescript

ionic-framework

ussd

0 Answers

Your Answer

Accepted video resources