Trying to get https://github.com/phonegap/phonegap-mobile-accessibility to work in Ionic v2 to stop my App formatting changing with system font size changes in Android


#1

I’m trying to get https://github.com/phonegap/phonegap-mobile-accessibility to work in Ionic v2 without success - it is not exposed by any of the methods present in the documentation.

I’ve tried accessing window.plugins in the platform ready event to find the object but windows.plugins itself is undefined.

The goal here is to STOP my application responding to Android system font size changes. eg if you set the font fize to Large in the system settings on an android, it will throw out all the formatting in my app.

If you can assist me to get the plugin working, there is apparently a method in there I can use to prevent the font zooming, otherwise open to other ideas on how to prevent the App using the system base font size.

Cheers


#2

You can do this.

import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';

// Since MobileAccessibility is on window, we can just set it's type to any.
declare var MobileAccessibility: any;
@Component({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
  zoom: string;
  constructor(
    public navCtrl: NavController,
    public platform: Platform
  ) {

    this.platform.ready().then(() => {
      MobileAccessibility.usePreferredTextZoom(false);
    });
  }
}

#3

I am also facing the same problem, but when your code, I got below Runtime Error
Uncaught (in promise): ReferenceError: MobileAccessibility is not defined ReferenceError: MobileAccessibility is not defined at http://localhost:8100/build/main.js:26244:13 at t.invoke
Please help


#5

A post was split to a new topic: Error: Uncaught (in promise): ReferenceError: MobileAccessibility is not defined ReferenceError: MobileAccessibility is not defined