Posts getagged mit "bug"

von c.kuetbach am October 12, 2012

Just found a new bug in android 3.2 WebView:

Assume you have created a nice hybrid application with phonegap. You set the viewport, with minscale, maxscale and usescalable=no.

The width of the viewPort is set to device-width.

BUT, in android 3.2 apps, you can drag your app arround.

Nothing to find with weinre, the DOM looks great.

Then I removed an css attribute from body:

body{
    -webkit-transform: translate3d(0,0,0) rotate(0) scale(1);
}

And the problem was gone.

von c.kuetbach am September 5, 2012

App Closes if Bask-Button is pressed while focussing input-element

I just encountered a interesting Bug within a Cordova/Phonegap App:

Everytime a user enteres something into a input-field, the softkeyboard will show up. But if the user hides the keyboard and than hit the Android-Back-Button the application closed.

No errormessage on screen, nothing strange in the log. Just a clear shutdown of the App.

If the user hides the keyboard, unfocus the input-field and hits back, the app worked as designed.

After some time I found the problem: The Bback-Button will end the DroidGap Activity, that closes the app.

This ISSUE at the Codova Issue-Tracker described a similar problem: Cordova Issue Tracker

I found a simple solution there. Just override some native Key-Events in you DroidGap-Activity:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    LOG.d(TAG, "KeyDown has been triggered on the view"+keyCode);
    //If volumedown key
    if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { 
        // only override default behaviour is event bound 
        LOG.d(TAG, "Down Key >Hit"); 
        this.loadUrl("javascript:cordova.fireDocumentEvent('volumedownbutton');"); 
        return true; 
    }
    // If volumeup key
    else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { 
        LOG.d(TAG, "Up Key Hit"); 
        this.loadUrl("javascript:cordova.fireDocumentEvent('volumeupbutton');"); 
        return true; 
    } else { 
        //return super.onKeyDown(keyCode, event); 
    }
    //return super.onKeyDown(keyCode, event);
    return true;
}

@Override
public boolean onKeyUp(int keyCode, KeyEvent event){
    LOG.d(TAG, "KeyUp has been triggered on the view"+keyCode);
    // If back key
    if (keyCode == KeyEvent.KEYCODE_BACK) { 
        this.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');"); 
        return true; 
    }
    // Legacy
    else if (keyCode == KeyEvent.KEYCODE_MENU) { 
        this.loadUrl("javascript:cordova.fireDocumentEvent('menubutton');"); 
        return true;     
    }
    // If search key
    else if (keyCode == KeyEvent.KEYCODE_SEARCH) { 
        this.loadUrl("javascript:cordova.fireDocumentEvent('searchbutton');"); 
        return true; 
    }
    return false;
}