Problems on android

Discussion created by tcoopman on Apr 30, 2013
Latest reply on May 1, 2013 by tcoopman
I have a problem with the ArcGIS Javascript API on android. (it could be linked with the problem I described  in a previous post (see here) but I don't believe this is the case, however I'm not sure so I'm linking the issue)

The problem occurs on android 4.2.2 with the Chrome browser.

After some navigation interaction (pinching, swiping, dragging,...) with the map I sometimes get the following error: Uncaught TypeError: Cannot read property 'identifier' of undefined

It's rather hard to debug the minified javascript code so I formatted it ( and ran it through a debugger to find out what the problem was.

In the function _touchMove:
 if (this._numTouches === 2) {
    var _ba1 = this._nodeTouches[0],
         _ba2 = this._nodeTouches[1];
    if (!this._pinchActive) {
       if (_b9f) {
          var _ba3 = _b9d[_ba1.identifier],
               _ba4 = _b9d[_ba2.identifier],

The error is on the line _ba4 = _b9d[_ba2.identifier]. Uncaught TypeError: Cannot read property 'identifier' of undefined and undifend is _ba2. The problem is that this._numTouches === 2 but _this._nodeTouches.length === 1

After debugging some more I found out that the problem must be with the _addTouch and _removeTouch method. I believe that _removeTouch is not always called but It's hard to confirm this. I've detected this by logging _this.numTouches. The behaviour I got was that touching with multiple fingers (more then 3 for example) and then lifting them again, _this.numTouches didn't always go down to 0.

As a fix for my own, I did this:

_addTouch: function (_bc4) {
  var i, _bc5 = _bc4.changedTouches,
         _bc6 = this._nodeTouches;
  this._numTouches = _bc4.touches.length;
  //this._numTouches += _bc5.length;

So instead of using _bc4.changedTouches.length I use _bc4.touches.length (likewise in _removeTouch). Are there any reasons changedTouches is used instead of touches?

Some follow up questions:

  • Is there any chance you will post your de-uglified API online? Maybe even make the API available on github?

  • Is this forum the right place to ask these kind of questions? This looks like a bug to me.