Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Android Manifest Not Working Properly

Discussion in 'Editor & General Support' started by Kantharr, Jan 28, 2013.

  1. Kantharr

    Kantharr

    Joined:
    Aug 14, 2012
    Posts:
    18
    Hey,

    we are having a problem trying to get the soft keyboard on the android device to not resize the game screen when we open it up. So far we only see this happen on the Galaxy Note but we want to prevent the keyboard from resizing the game screen. I have heard from other people that I will need to create a custom android manifest xml file that contains android:windowSoftInputMode="stateVisible|adjustPan" which I have and I properly added it in the Asset/Plugins/Android folder. I even checked after the game was built to see if it has added the custom manifest file. It has added the manifest, but the game would still be squished by the device.

    Here are the image comparisons of the Galaxy Note:



    Here is the manifest file:

    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.     xmlns:android="http://schemas.android.com/apk/res/android"
    4.     package="com.unity3d.player"
    5.     android:installLocation="preferExternal"
    6.     android:versionCode="1"
    7.     android:versionName="1.0">
    8.     <supports-screens
    9.         android:smallScreens="true"
    10.         android:normalScreens="true"
    11.         android:largeScreens="true"
    12.         android:xlargeScreens="true"
    13.         android:anyDensity="true"/>
    14.  
    15.     <application
    16.         android:icon="@drawable/app_icon"
    17.         android:label="@string/app_name"
    18.         android:debuggable="true">
    19.         <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
    20.                   android:label="@string/app_name"
    21.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    22.                   android:windowSoftInputMode="stateVisible|adjustPan">
    23.             <intent-filter>
    24.                 <action android:name="android.intent.action.MAIN" />
    25.                 <category android:name="android.intent.category.LAUNCHER" />
    26.             </intent-filter>
    27.         </activity>
    28.         <activity android:name="com.unity3d.player.UnityPlayerActivity"
    29.                   android:label="@string/app_name"
    30.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    31.                   android:windowSoftInputMode="stateVisible|adjustPan">
    32.         </activity>
    33.         <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    34.                   android:label="@string/app_name"
    35.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    36.                   android:windowSoftInputMode="stateVisible|adjustPan">
    37.             <meta-data android:name="android.app.lib_name" android:value="unity" />
    38.             <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    39.         </activity>
    40.         <activity android:name="com.unity3d.player.VideoPlayer"
    41.                   android:label="@string/app_name"
    42.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    43.                   android:windowSoftInputMode="stateVisible|adjustPan">
    44.         </activity>
    45.     </application>
    46. </manifest>
    The only plugins we are using are Prime31 Localytics, NGUI, and Multi-Platform Toolkit Suite. Any help will greatly be appreciated. (BTW ignore the volume image that you see in the picture, I accidentally hit another button at the same time I was taking the screenshot).
     
    Last edited: Jan 28, 2013
  2. Kantharr

    Kantharr

    Joined:
    Aug 14, 2012
    Posts:
    18
    [BUMP] At the moment we are just continuing with our project by working on other features and bug fixes but this problem is slowing us down a bit on the android side of the project. As soon as we get help on this and get it fixed the sooner we can submit it so any kind of help will be very much appreciated.
     
    Last edited: Jan 29, 2013
  3. Tappable

    Tappable

    Joined:
    Dec 22, 2012
    Posts:
    8
    I have a same problem. Anyone can help?
     
  4. Kantharr

    Kantharr

    Joined:
    Aug 14, 2012
    Posts:
    18
    We are still chugging along with our game but this keyboard problem is the only thing that is holding us back on the android. We did try it on our Galaxy Tablet but the keyboard works fine on it. I also notice that none of the Unity keyboard settings have a previous/next buttons so I guess we have to create those ourselves through plugins?
     
  5. Tappable

    Tappable

    Joined:
    Dec 22, 2012
    Posts:
    8
    Any Progress on this? Im testing on very simple scene with just few NGUI UIInputs and scaling doesnt occur. I have no idea
     
  6. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
  7. Tappable

    Tappable

    Joined:
    Dec 22, 2012
    Posts:
    8
    GOT IT!
    In BuildOptions/Resolution and Presentation uncheck "Status Bar Hidden". Im not sure how this is connected but fixed this problem in my case. I didnt have to edit AndroidManifest file.

    Let us know if it helped.
     
  8. Kantharr

    Kantharr

    Joined:
    Aug 14, 2012
    Posts:
    18
    Yeah that did not help me at all. I am going to do what koyima said and hopefully they could be able to help me. Thanks anyways.
     
  9. Kantharr

    Kantharr

    Joined:
    Aug 14, 2012
    Posts:
    18
    [BUMP] I went ahead and sent support an email about this and some other features (like TouchScreenKeyboard.area returning zero or the game can't tell the difference between pressing the ok button and pressing outside the keyboard). They will reply within 5 working days which is past our due date but at least we could submit the iOS version of the game on time.
     
  10. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    I found this:
    <activity android:name="com.unity3d.player.UnitySoftInputActivity" android:label="@string/app_name" android:screenOrientation="behind" android:windowSoftInputMode="stateAlwaysVisible|adjustPan">

    Not tested though... although that sounds promising.

    By the way, where can I find some docs about classes such as UnitySoftInputActivity?
     
  11. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    Did you ever manage to get this issue sorted out? I'm having the same problem when using Daikon Forge GUI on Android when the status bar is NOT hidden. The whole screen squashes when the onscreen keyboard appears.
     
  12. Kafeen

    Kafeen

    Joined:
    Aug 5, 2011
    Posts:
    26
    Necro Thread:

    To anyone else experiencing this problem, It's possible to get around the issue by adding :

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);

    to a native extension overriding the UnityPlayerActivity.
     
  13. jlegrice

    jlegrice

    Joined:
    Nov 21, 2012
    Posts:
    6
    Thank you for very much for this advice! :)
     
  14. eab6863

    eab6863

    Joined:
    Feb 12, 2015
    Posts:
    4
    I am very new to interacting with native code and could use some help. My code below gets the reference to the window and then calls setSoftInputMode() but I get a android.view.ViewRoot$CalledFromWrongThreadException.
    Code (CSharp):
    1. using(AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    2.         {
    3.             AndroidJavaObject activity = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
    4.             AndroidJavaObject window = activity.Call<AndroidJavaObject>("getWindow");
    5.  
    6.             window.Call("setSoftInputMode", 5);
    7.         }