No substitute for platform.exitApp() and keyboard.isOpen() after migration to V4

I’ve almost done migrating my project to V4. There are two issues I can’t find docs about.

  1. Is there any substitute for platform.exitApp() which is no longer available in V4?
  2. Keyboard is no longer an ionic component in V4. I tried to install the native Keyboard plugin following steps in ionic native docs. But after ‘npm install -save @ionic-native/keyboard’, I got it as version 4 instead of 5 as the statusbar is and there is no ‘ngx’ subfolder for it, so I guess maybe some plugin hasn’t got their versions updated to match ionic4?
    Anyway, I tried to use the Keyboard plugin and found there was no isOpen() method as my previous Keyboard component had, so is there any substitute?

I’ve got the keyboard plugin installed as the correct version 5.0.0beta14. Still the two issues remains.

This, at least long term, is what you want

https://capacitor.ionicframework.com/docs/apis/keyboard/

But I don’t know if it’s production-ready today.

Edit: also, there’s an exit command here: https://capacitor.ionicframework.com/docs/apis/app

The keyboard isn’t related to v4, it’s been a while since it’s like this

You could do like described in the documentation https://github.com/ionic-team/cordova-plugin-ionic-keyboard aka

window.addEventListener('keyboardDidShow', (event) => {
    // Describe your logic which will be run each time when keyboard is about to be shown.
    console.log(event.keyboardHeight);
}); 

alternatively have a look to https://github.com/ionic-team/ionic-native/issues/2306

Thanks for reply. I’m using ionic4 with angular 6. So after reading all the links above, I think the ionic/ native/keyboard/ngx is expected to have a ‘isVisible’ property which is what I want exactly, and it’s documented for the cordova plugin but not available for now. I guess I should wait for this issue addressed as the team updates the beta. Same with the exit method.
I’m not sure if I should post an issue on github.

I think that would be a good idea. If you get additional information there, please update here if you can.

1 Like