Log in or register to post comments

Problem with screenOrientation on Android and other plugins

August 12, 2014 - 1:39am #1
Hello everyone,
 
We have a screenOrientation problem with our Unity Android application
It seems when we stay in the Unity context, the auto-rotation is correctly managed, but when we start others plugins activitys (uniwebview, facebook etc...), they didn't receive the auto-rotate event correctly. Sometimes, they are turned, but not correctly resized.
 
Taking the sample of the uniwebview plugin. The auto-rotation is correctly managed when this plugin is the main activity without vuforia. But when we use vuforia and so, QCARPlayerNativeActivity become the main activity, the container of the webview is rotated but not correctly resized.
 
This plugin includes source-code, so we tried to modify it. Our UniWebView activity (called AndroidPlugin) extends now QCARPlayerNativeActivity (and so no more UnityPlayerNativeActivity), but the matter stay the same... the container of the webview is rotated but not correctly resized.
 
We have tried too, to set the value of the attribute android:screenOrientation to fullSensor for the QCARPlayerNativeActivity, but something during the build process, seems cancel this change and  reset it automatically to the sensor value.
 
What can we do to correctly apply the auto-rotation to these type of plugin ?
 
Our configuration is the next :
-Vuforia vuforia-unity-android-ios-3-0-9. 
-Unity 4.5.2
-Minimum API Android 2.3.1
-Our default orientation is defined to Auto-Rotation in the Android Build Settings
 
 

 

Problem with screenOrientation on Android and other plugins

August 27, 2014 - 7:45am #5

hello, thanks you for your aswer

it is only a warning and i can compile the proyect, but the problem is that when i import the proyect to eclipse the same problem is there , and for that i can't build the apk.

i have try to fix it in eclipse but i am not sure how , it,s for that that i was trying to fix it in unity.

i would like to ask you a cuple of cuestions, first, do you work with mac o pc, i have build my proyect with mac and i strat to think tnat there sould be a problem...in second place ;do you work with eclipse too or how do you build your apk.i don´t know if  the problem sould be relationated with that.do you have eny idea of how to fix it in eclipse..

 

 

thank you.

 

 

 

Problem with screenOrientation on Android and other plugins

August 26, 2014 - 11:13pm #4

Does it really an error or only a warning ? 

It seems to me that I have exactly the same warning with current release of Vuforia since 4.5.x Unity release, but it doesn't prevent my apps to correctly work.

 

 

Problem with screenOrientation on Android and other plugins

August 26, 2014 - 7:25pm #3

hi

i`m trying to make an apk of augmented reality in unity and vuforia that i will compile in eclipse but i have a problem when i build the project for android in unity. it seem ther is some mistake in the android manifest that unity generate automatic,

 

the error line is

 

Unable to find unity activity in manifest. You need to make sure orientation attribute is set to fullSensor manually.

 

i have try to change it in te manifest when i import the proyect to eclipse but the problem persist.

this is the manifest i have

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jauma.art.projectAR1"
android:versionName="1.0" android:versionCode="1"
android:installLocation="preferExternal">
  <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="20" />
  <uses-feature android:name="android.hardware.camera" />
  <supports-screens android:smallScreens="true"
android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name"
 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
 android:debuggable="false">
    <activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity"
 android:label="@string/app_name" android:screenOrientation=“sensor"
 android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.unity3d.player.VideoPlayer" android:label="@string/app_name" android:screenOrientation=“sensor" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    </activity>
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
  <uses-feature android:name="android.hardware.camera.front" android:required="false" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
<!-- android:installLocation="preferExternal" -->

 

some one could give me a litle help with that?

thank you

Problem with screenOrientation on Android and other plugins

August 12, 2014 - 1:58am #2

Ohhh sorry, we have fixed our problem !

In fact, the process we have declared upper is correct. The only last thing to do is to change the main activity in the manifest.

So now, our main activity is not QCARPlayerNativeActivity but the AndroidPlugin activity of the uniwebview plugin. And it perfeclty works (Vuforia is always start at the begining, and the webview recieve correctly auto rotation informations) !

Log in or register to post comments