Reputation: 1643
I have a phonegap app which i create using adobe phonegap-build, and i have 2 simple problems that are very hard! to fix.
It seems everything that i do, just doesn't do much good.
1)In android i want the app to be full screen (without the bar of "home","return","multi-window"), full screen!
2) I want the app to be landscape only, which it is most of the time, but for a few seconds in the begining (when entering the app), the orientation is portrait and only after a few it fixes itself, not a good behaviour at all
This is the code that is in my cordova config.xml:
<preference name="orientation" value="landscape" />
<preference name="screen-orientation" value="landscape" />
<preference name="permissions" value="none" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="7" />
<preference name="android-installLocation" value="auto" />
<preference name="Fullscreen" value="true" />
<preference name="EnableViewportScale" value="true" />
<preference name="DisallowOverscroll" value="true" />
<preference name="UIWebViewBounce" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000" />
I also have a plugin that deals with screen lock:
<gap:plugin name="net.yoik.cordova.plugins.screenorientation" version="1.3.1" />
All is great on iphone, but in android, how do i fix those things?
maybe this will help?
http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html
http://stackoverflow.com/questions/4675750/lock-screen-orientation-android
To better understand the structure of the program that uploads to phonegap build:
-css
-img
-js
-lib (libraries like angular,jquery and such)
-modules (all the html here)
-res (icons and screen for splash and such)
-spec (tests)
application.js (my all javascript minified here)
config.xml
icon.png
index.html
spec.html
splash.png
All this files are being zipped everytime, and uploaded to phonegap-build
Upvotes: 1
Views: 1861
Reputation: 1803
Try to solve the first problem, disable the bottom bar is possible, you must set for this activity the SYSTEM_UI_FLAG_HIDE_NAVIGATION, it ca be possible in native code, or, seems to be posible with this plugin
Follow the readme , i use it in the simplest quick&dirty way by adding this code to the startpoint of the application:
AndroidFullScreen.leanMode(function(){alert("success");}, function(){alert("error");});
For the second problem, it seems to be a common issue, with a clean app with only this preferences in config.xml:
<preference name="Fullscreen" value="true" />
<preference name="Orientation" value="landscape" />
It works perfect, maybe the splash screen or another preference can affect your project. You can try to check if the activity in the file platforms/android/AndroidManifest.xml have all the attributes to works in landscape mode, and if so...you can add this code to the MainActivity.java in the method onCreate, before the super.onCreate(savedInstanceState);:
@Override
public void onCreate(Bundle savedInstanceState)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
In this way we try to do harcoded the same functionality implemented by the preference in the config.xml.
Upvotes: 1