window.MobileAccessibility not defined

My app calls window.MobileAccessibility.usePreferredTextZoom() to fix the font size. It used to work using PGB. Now it is not working because window.MobileAccessibility is not defined (I only tried the Android build). Any idea why this is happening?

According to the log file, the plugin is installed:

Discovered plugin "phonegap-plugin-mobile-accessibility". Adding it to the project

Project Installed Plugins:
...
    phonegap-plugin-mobile-accessibility: 1.0.5-dev

--- Start of Cordova JSON Snippet ---
{
  "plugins": {
    "cordova-plugin-whitelist": {},
    "cordova-plugin-device": {},
    "phonegap-plugin-mobile-accessibility": {},
    "cordova-plugin-statusbar": {},
    "cordova-plugin-splashscreen": {}
  },
  "platforms": [
    "android"
  ]
}

— End of Cordova JSON Snippet —

Tip : If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)

When are you calling window.MobileAccessibility.usePreferredTextZoom()? You can’t call it until the plugins are all loaded at runtime.

Wait for the deviceready event:

document.addEventListener("deviceready", onDeviceReady, false);

See Events - Apache Cordova

For some reason, deviceready is not fired (timed out after one minute). How is this possible?

Are there any messages in the Chrome Remote Console?

When I compared the old apk and the new one, the VoltBuilder version does not contain the phonegap.js file in the assets/www directory.

How can I get it to be included? My config file has the following lines:
preference name=‘phonegap-version’ value=‘cli-9.0.0’
preference name=‘pgb-builder-version’ value=‘2’

phonegap.js isn’t used anymore (for the expected reasons). It’s been replaced by cordova.js.

Are there any messages in the Chrome Remote Console?

There are only my console.log() messages. The only system errors are for not finding the map files (DevTools failed to load source map: Could not load content for file:///adroid_asset/www/xxx.map: System error net: net::ERR_FILE_NOT_FOUND) but the map files are in the www directory in the zip file. Any idea why they cannot be found?

The onDeviceReady() callback is never called. Cordova is supposed to log a message if deviceready is not fired after 5 seconds but I do not see that. If phonegap.js is not used, who fires the event? And what else can I try?

phonegap.js has been replaced by cordova.js - it should be firing the event.

The map files not being found is normal. It’s not one you need to worry about. It only happens when you are running with the Chrome Debugger open. It’s complaining that it does not have the extra files it needs to display the source code properly. Since it is very unlikely that you will have any need to look at that code, it doesn’t matter.

If it really bugs you, you can go into the Debugger Preferences and turn off the warning. The setting to turn off is “Enable Source Maps”.

There is more info here.

Thank you so much for your reply, so I don’t need to worry about the map files.

Not sure why window.MobileAccessibility is not defined (I listed the properties of window and it is not there) even though here is an entry phonegap-plugin-mobile-accessibility.mobile-accessibility in cordova_plugin.js with clobbers set to window.MobileAccessibility. If it is not created by cordova, can it be created from my code?

The onDeviceReady() callback is never called. It looks like phonegap fired it but now cordova does not.
Is it possible for your team to check that? (The PLATFORM_VERSION_BUILD_LABEL in cordova.js is 9.1.0.)

Your help is very much appreciated!

Try adding this into your index,html file, in the <head> section:

<script src="cordova.js"></script>

We’ve also updated the sample, so you can try that as well:

That’s it! My index file has this line but I forgot the build process generates a new one and I need to add the line back each time. Now I copy the file from the work directory instead of the build directory when I do the zipping.

Thank you so much for the support! It is way better than PGB and it’s worth every penny I spent. Really appreciate all the great features that have been done for us!