Forcing Portrait Orientation on Android PhoneGap

I’ve made some good progress on my Barcode Bots project: most notably I found out (after much flailing) how to force Portrait orientation in Android PhoneGap. A simple addition to the main class in my project’s _AndroidActivity.java did the trick (see below).

I’ve also added a new screen, the help screen, and was able to test the Barcode Scanner PhoneGap plugin on an actual device. Success! Download the current code here.

public void onConfigurationChanged(Configuration newConfig)
    {
        super.onConfigurationChanged(newConfig);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    };  
}