I have an Andoid “phone/tablet” PDA with Android 8.1.0 that has built-in barcode scanner(2D)
It works like any Android device, and installing an APK file/app onto it works like any android tablet or phone etc - This PDA has it’s own numeric keyboard - very important feature. Data input will come from scanning barcodes and then tapping a quantity on the numeric buttons
My issue is that I want to control when the keyboard is displayed. That is, toggle if I want it visible for or
The code below is the solution I have at the moment. I can “listen” for when the keyboard is being displayed and then make it hide. BUT the keyboard wants to display everytime the element gets focus and when I enter a character into these input elements or . It looks strange seeing this keyboard start it’s display then suddenly hide (over and over with each character)
What do I want? to control when the keyboard is visible, not have it displaying and then hiding with each character
The code below is my test page. Unfortunately the test process involves loading the app into Android Studio and running the simulator.
import { Component, OnInit } from ‘@angular/core’;
import { HttpApiService } from ‘src/app/services/http-api.service’;
import { ToastController } from ‘@ionic/angular’;
import { Plugins } from ‘@capacitor/core’;
const { Keyboard } = Plugins;
@Component({
selector: ‘app-transfer’,
templateUrl: ‘./transfer.page.html’,
styleUrls: [’./transfer.page.scss’],
})
export class TransferPage implements OnInit {
activeTransfers: any;
selectedTransfers: any;
constructor(private api: HttpApiService, public toast:ToastController) {
this.getAllObjects(‘activetransfers’);
Plugins.Keyboard.addListener('keyboardWillShow', (info: any) => {
this.presentToast('keyboard about to load');
Keyboard.hide();
});
}
show() {
Keyboard.show();
}
hide() {
Keyboard.hide();
}
Ionic CLI : 5.4.14 (/Users/Peter/.nvm/versions/node/v10.12.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.0.1
@angular-devkit/build-angular : 0.803.25
@angular-devkit/schematics : 8.3.25
@angular/cli : 8.3.25
@ionic/angular-toolkit : 2.1.2
Capacitor:
Capacitor CLI : 1.5.0
@capacitor/core : 1.5.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v10.12.0 (/Users/Peter/.nvm/versions/node/v10.12.0/bin/node)
npm : 6.13.7
OS : macOS Catalina
Xcode : Xcode 11.3.1 Build version 11C504