1

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

totothegreat
  • 1,633
  • 4
  • 27
  • 59

1 Answers1

1

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.

phemt.latd
  • 1,775
  • 21
  • 33
  • that code above, where can put it so it will be available for Interpretation in phonegap-build, cause only the www folder goes in it, not the platform stuff and so... – totothegreat May 07 '15 at 09:56
  • Don't you have a folder platforms under the root dir of your phonegap's project? – phemt.latd May 07 '15 at 10:16
  • in phonegap project yes, but in the phonegap build there is no plaforms and such, it just asks for the www folder inside the phonegap project. – totothegreat May 07 '15 at 10:25
  • Change it in the phonegap project and it will change in the phonegap build – phemt.latd May 07 '15 at 10:32
  • The structure of my program is at the question now, there are the only things zipped and sent to phonegap-build – totothegreat May 07 '15 at 11:22
  • Ok, now i understand, you use a cloud build solution! Maybe with this kind of solution i don't i know if you can work directly on the native android source. If not possible you must try to work with preference and plugin... – phemt.latd May 07 '15 at 12:06