Error with the Mobile Accessibility plugin

I am running into the same error with the Mobile Accessibility plugin. I’m building on a mac, I have followed all the different ways to install the plugin listed above and everything looks successful but once I build and install the app I am getting the “Native: tried calling MobileAccessibility.getTextZoomCallback, but the MobileAccessibility plugin is not installed.” followed by “Install the MobileAccessibility plugin: ‘ionic cordova plugin add phonegap-plugin-mobile-accessibility’”

A couple people that posted on here said that they were successful in installing the plugin and I’m not doubting that. What I am wondering is if anyone else tried to build and run the an app with this plugin installed. Have you been able to get a successful response from the getTextZoomCallback() function?

The documentation says to use: import { MobileAccessibility } from ‘ionic-native’;

Which causes its own error so I ended up switching the import to:

import {MobileAccessibility} from ‘@ionic-native/mobile-accessibility’;.

I’m just guessing that this is a very low usage plugin so it isn’t kept up to date which is fine but if it is no longer functioning with the latest version of ionic, would it be better to just remove it from the Ionic Native documentation?

Which documentation are you looking at? Link please.

Thanks, this seems to be outdated documentation. Ionic Native is fully community supported and maintained. You could use the “Improve this doc” link to submit a PR that fixes the example to what you posted. For the other things: This plugin was only added to Ionic Native back in May, so maybe really nobody really tested it properly.

Can you share what you have in a blank Ionic project (ionic start blank blank) and put it on Github?

Sure, I’ll do the PR to update the documentation and then build a blank app and try to use the plugin. I’ll post a link to github shortly.

1 Like

Here is the link to the blank demo app with the Mobile-Accessibility included. I added and built for android and I am still getting this error after installing it on my device:

GitHub Link: https://github.com/justinblake/ionic-demo-app

Thanks for looking into this.

1 Like

So I tried looking into this.

When I run the command to install the cordova plugin I already get an error:

PS C:\Users\Jan\Documents\ionic-native-mobile-accessibility> ionic cordova plugin add phonegap-plugin-mobile-accessibili
ty
> cordova plugin add phonegap-plugin-mobile-accessibility --save
× Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova plugin add phonegap-plugin-mobile-accessibility --save (exit code 1):

        Installing "phonegap-plugin-mobile-accessibility" for android
        Plugin dependency "cordova-plugin-device@1.1.4" already fetched, using that version.
        Dependent plugin "cordova-plugin-device" already installed on android.
        Failed to install 'phonegap-plugin-mobile-accessibility': Error
        at C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:205:33
        at _rejected (C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:864:24)
        at C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:890:30
        at Promise.when (C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:1142:31)
        at Promise.promise.promiseDispatch
        (C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:808:41)
        at C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:624:44
        at runSingle (C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:137:13)
        at flush (C:\nvm\v8.1.3\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:125:13)
        at _combinedTickCallback (internal/process/next_tick.js:95:7)
        at process._tickCallback (internal/process/next_tick.js:161:9)
        Error: Failed to fetch plugin https://github.com/apache/cordova-plugin-network-information.git via registry.
        Probably this is either a connection problem, or plugin spec is incorrect.
        Check your connection and plugin name/version/URL.
        Error: cmd: Command failed with exit code 1 Error output:
        npm ERR! code 1
        npm ERR! Command failed: C:\Program Files\Git\cmd\git.EXE submodule update -q --init --recursive
        npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
        npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
        npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 18: .: git-sh-setup: file not found
        npm ERR!

        npm ERR! A complete log of this run can be found in:
        npm ERR! C:\Users\Jan\AppData\Roaming\npm-cache\_logs\2017-08-03T12_42_07_909Z-debug.log

Did you also get that?

Trying a few more times it worked for me, seems my connection to Github is flaky today.

Ok, I can reproduce the Ionic Native plugin not working with the output you posted.

But using the Cordova plugin directly does work. That is strange and indicates that something is wrong with the Ionic Native wrapper.

So here is my project were I reproduced this after your Github repo:

There is an example in there how to use the plugin directly that works and is quite simple.

And here is the issue I just created:

That is great news. I appreciate all the work you guys do. I’m going to go through that and I’ll let you know how it goes.

Thanks again

try in v4 ionic

declare var window: any;

and

getTextZoomCallback(textZoom) { // is my function callback
console.log('Current text zoom = ’ + textZoom + ‘%’)
}

call in init

window.MobileAccessibility.getTextZoom(this.getTextZoomCallback);

great success!!