In the application, you need to block the ability to rotate the device. For this, I wrote the following line in the manifest

android:screenOrientation="portrait" 

Here

 <activity android:name=".activities.Splash" android:label="@string/app_name" ----> android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 

I work on Samsung S5 Android 5.1, why can this function not work for me?

I also read that with the release of android 5.0 more customization options appeared ...

 android:screenOrientation=["unspecified" | "behind" | "landscape" | "portrait" | "reverseLandscape" | "reversePortrait" | "sensorLandscape" | "sensorPortrait" | "userLandscape" | "userPortrait" | "sensor" | "fullSensor" | "nosensor" | "user" | "fullUser" | "locked"] 

But nothing works for me ... Who solved this problem already?

Whole manifest file

 <?xml version="1.0" encoding="utf-8"?> 

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <!-- GCM requires a Google account. --> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- For Google+ LogIn --> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <!-- Для регистрации приложения в GCM всякий раз, когда телефон перезагружается. --> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!-- Keeps the processor from sleeping when a message is received. --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- This app has permission to register and receive data message. --> <uses-permission android:name="com.google.android..RECEIVE" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <permission android:name="com.example.android.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.example.android" /> <application android:name=".authorization.MyFacebook" android:allowBackup="true" android:icon="@drawable/title" android:label="@string/app_name" android:theme="@style/MaterialTheme"> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" /> <activity android:name=".activities.Splash" android:label="@string/app_name" android:screenOrientation="locked"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <receiver android:name=".gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.example.android" /> </intent-filter> </receiver> <service android:name=".gcm.GcmIntentService" /> <activity android:name=".activities.AcceptNotAccept" android:theme="@style/AppTheme.CustomStyle" /> <activity android:name=".activities.PopUpActivity" android:theme="@style/AppTheme.CustomStyle" /> <activity android:name=".tools.TestDeleteIt" /> <activity android:name=".activities.Welcome2" /> <activity android:name=".activities.WebActivity" /> <activity android:name=".authorization.AuthorizationActivity" /> <activity android:name=".activities.WebViewAcceptReject" /> <activity android:name=".activities.CameraActivity" /> <activity android:name=".authorization.LogIn" /> <activity android:name=".authorization.RegistrationActivity" /> <activity android:name=".activities.ForgotYourPassword" /> <activity android:name=".activities.MainActivity" /> <activity android:name=".activities.VideoActivity"/> <activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> </application> </manifest> 
  • and in <application, do you have that thread associated with turns? - iFr0z
  • android:name=".activities.Splash" and this is the name of the activ, in which should be the desired orientation? - DimXenon
  • @ iFr0z Added the entire manifest file. Nothing seems to be there ... - Aleksey Timoshchenko
  • @DimXenon Orientation is needed throughout the application ... - Aleksey Timoshchenko
  • I see android:screenOrientation="locked"> . This option saves the screen orientation that occurred when the application was started. Read more here: stackoverflow.com/questions/21361338/… ... - DimXenon

0