Skip to content
Philzen edited this page Aug 27, 2012 · 20 revisions

Installation

Getting OpenLayers Pinch-Zoom and all the other cool stuff working on 2.x: Grab the latest release version from https://github.com/Philzen/WebView-MultiTouch-Polyfill/tags

and then...

For native android apps

  1. Copy wmp.jar into your own projects' libs folder

  2. In your Main Activity, create a new WebClient object, passing in the WebView that you want to enable multitouch on:

     WebClient wmp = new WebClient(webview);
    

Refer to the MainActivity of the demo app to see the command in context.

Enabling Multitouch for Phonegap 1.9+ (Cordova) projects

  • As above, but instead of WebClient use CordovaWebClient:

      CordovaWebClient wmp = new CordovaWebClient(this, appView);
    

Enabling Multitouch for legacy (pre-1.9) phonegap projects

  1. Copy WebClient.java and PhonegapWebClient.java from src/com/changeit/wmpolyfill/ into your project. You will need to refactor those classes namespace to match those of your project - some IDEs (i.e. Netbeans) will do that conveniently for you as you paste the files

  2. In your Main (DroidGap) Activity, instantiate a new PhonegapWebClient:

     PhonegapWebClient wmp = new PhonegapWebClient(this, appView);
    

This solution was tested with Phonegap 1.8.1 and should work with many earlier versions.

Usage Options

  • setPolyfillAllTouches (Boolean) [default: false]

    Per default WMP won't do anything to single hand gestures in order not to interfere with varying event implementations on different devices. If you set this value to true, all touches on the webview will be intercepted and emulated in the polyfill.

    NOTE: The polyfill won't interfere with any touches (basically it will be inactive) if the API Level is 11 or higher (= devices running Android 3+)

Please visit the supported device page and check whether WMP ran on any like yours before, if not, help yourself and others by adding your device name & OS.

In case of problems, please don't hesitate to report a bug including those details.