Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Phonegap(Android) splash screen orientation

I added a splash screen to my phonegap application by adding the super.setIntegerProperty("splashscreen", R.drawable.splash); line before the super.loadURL... line in the DefaultActivity.

Is there a way to lock only the splash screen's orientation to portrait without locking the whole application?

like image 725
user992804 Avatar asked Mar 07 '12 06:03

user992804


1 Answers

After many searches I've found that the right way to address splash screen orientation is to manage two images using this code into your MainActivity

 if (getResources().getConfiguration().orientation == 2) {
        super.setIntegerProperty("splashscreen", R.drawable.splashlandscape);
        Log.d("Orientation", "Landscape");
    }
    else {
        super.setIntegerProperty("splashscreen", R.drawable.splashportrait);
        Log.d("Orientation", "Portrait");
    }
like image 130
Martin Borthiry Avatar answered Sep 20 '22 00:09

Martin Borthiry