@merma90 wrote:
Hey everyone!
I’m sorry to bother but I can’t figure out what’s happening to my code and how to solve the problem as my programming skills aren’t good …
I implemented this following code to have mobile accessibility on my app. Whenever the Screenreader (Talkback etc.) is acitvated, the phone should alert the (visually impaired) person that it is activated. But I can’t continue as my code is telling me the following problem:
TS2339: Property ‘MobileAccessibility’ does not exist on type 'Window’
and
TS2339: Property ‘isChromeVoxActive’ does not exist on type ‘typeof MobileAccessibility’And I don’t even know if I’m not missing something important in my code…
The whole .ts is here:
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { MobileAccessibility } from ‘@ionic-native/mobile-accessibility’;@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’,
})export class HomePage {
constructor(public navCtrl: NavController, private mobileAccessibility: MobileAccessibility) {
// TalkBack for Android function isTalkBackRunningCallback(boolean) { if (boolean) { console.log("Screen reader: ON"); mobileAccessibility.speak('Screen Reader active'); } else { console.log("Screen reader: OFF"); } } window.**MobileAccessibility**.isTalkBackRunning(isTalkBackRunningCallback); // Screenreader for Android and Amazon Fire OS function isScreenReaderRunningCallback(boolean) { if (boolean) { console.log("Screen reader: ON"); mobileAccessibility.speak('Screen Reader active'); } else { console.log("Screen reader: OFF"); } } window.**MobileAccessibility**.isScreenReaderRunning(isScreenReaderRunningCallback); // VoiceOver for iOS function isVoiceOverRunningCallback(boolean) { if (boolean) { console.log("Screen reader: ON"); mobileAccessibility.speak('Screen Reader active'); } else { console.log("Screen reader: OFF"); } } window.**MobileAccessibility**.isVoiceOverRunning(isVoiceOverRunningCallback); // ChromeVox for Google window.**MobileAccessibility**.isTalkBackRunning( function (bool) { console.log('Talkback status: ' + bool); if (bool) { setTimeout(function () { if (MobileAccessibility.**isChromeVoxActive**()) { console.log('ChromeVox is active.'); } else { console.log('ChromeVox is not active.'); mobileAccessibility.speak('The ChromeVox screen reader has failed to initialize.' + 'You may wish to close and restart this app.') } }, 5000); } });
}
}
Does anybody know whta to do or what I am missing? I really don’t have any clue and I can’t find examples to compare to my code…
With kind regards
- Stephanie
Posts: 1
Participants: 1