Hi,
I red that the App portrait properties is read only = bool.
So, How to make App orientation to always to be portrait?
Kind Regards
Tagged: App orientation, portrait
Hi,
I red that the App portrait properties is read only = bool.
So, How to make App orientation to always to be portrait?
Kind Regards
Hi Niyazi,
you can configure the portrait / landscape setting for iOS / Android with different configurations in the android/AndroidManifest.xml or ios/Project-Info.plist. This is similar to developing native applications without Felgo. For an example how these files look like when configured appropriately, you can create a new Felgo Project with the Qt Creator project wizard and choose the orientation setting in the wizard dialog.
When the project is created, the wizard then automatically configures the manifest and plist configuration for your chosen setting.
Best,
Günther
Thanks Günther.
I did what you describe. But is not working. I create a 3 times new project and set orientation to portrait in the wizard. But everytime I hold my phone landscape mode, my app also changes to landscape. Here is the newly created project qml->config.json, android->AndroidManifest.xml and the ios->Project-Info.plist. When I hold my phone landscape mode I need my app to stay as potrait.
config.json
{
"title": "CAPITAL",
"identifier": "com.CAPITAL",
"orientation": "portrait",
"versioncode": 1,
"versionname": "1.0",
"stage": "test"
}
AndroidManifest.xml
<div></div>
<div><?xml version='1.0' encoding='utf-8'?>
<manifest package="com.CAPITAL" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="net.vplay.helper.VPlayApplication" android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="net.vplay.helper.VPlayActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps --></div>
<div> <!-- Splash screen -->
<!--
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
-->
<!-- Splash screen --></div>
<div> <!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running --></div>
<div> <!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/></div>
<div> <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS --></div>
<div> <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES --></div>
<div></manifest></div>
<div></div>
Project-Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>CAPITAL</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.CAPITAL</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UIStatusBarHidden</key>
<true/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>NSPhotoLibraryUsageDescription</key>
<string>App would like to access the library.</string>
<key>NSCameraUsageDescription</key>
<string>App would like to access the camera.</string>
</dict>
</plist>
Hi,
the code looks correct, and I also tried different settings (auto, landscape, portrait) with the wizard, which works fine.
To avoid potential issues from a previous builds or app version, please:
Do you still have issues with portrait-only then?
If yes, which devices are experiencing this issue on, and does it happen for both iOS and Android?
Best,
Günther
Hi Günther,
What do you mean by shadow build directory? I clean the way that you describe in your post. I clean previous app from my mobile.
Unfortunately, orientation portrait is not working on Samsung Galaxy S7 Edge (Android 6.0 Marshmallow and the Android 7.0 Nougat)
But likely I test my app with my friends iPhone 5 (iOS 10.3.3) and the orientation.portrait is working.
I have no idea why is not working in my mobile.
Kind Regards
By the way I uninstall the Felgo from my macOS High Sierra (10.13.2). I clean everything related to Felgo. And I download and clean install Felgo. Still the same issue.
Hi Niyazi,
when you build your project with Qt Creator, a new folder is created besides your project folder (the shadow build directory). It is usually named something like “build-<project>-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_3_Android_armv7_V_Play-Debug”. To speed up the building process, relevant build files are re-used at later builds and kept in the shadow build folder. This can cause issues sometimes, which is why I recommended to delete this folder before creating a new build.
One additional question:
Are you building and testing your own Android app with the Android Build Kit or are you using the Felgo Live App for testing?
The Felgo Live App always has to support both interface orientations, as it is a finished application with pre-configured AndroidManifest.xml. Your own manifest configuration can only be used with a custom app build using the Android Build Kit.
Best,
Günther
Thanks Günther,
Yes, I clean the “build-<project>-Android … folder as well.
I am using Felgo Live App and my Qt Kids points the “Android for armeabi-v7a(GCC 4.9, Qt 5.9.3 Android armv7 Felgo” when I run the Qt LIVE green button.
Hi, I see – thanks for clarification!
As posted above, the Felgo Live App, which let’s you quickly preview your app on the device, always supports both portrait and landscape (regardless of the AndroidManifest configuration). To test your own portrait-only setting, you can build and deploy your own application package (.apk) for Android.
To do this, you can close Felgo Live for your project, and build/run the “Android for armeabi-v7a(GCC 4.9, Qt 5.9.3 Android armv7 Felgo” with the regular play button (no Felgo Live involved). It is required to connect your Android phone to your computer with a cable, so your built application can be transferred and installed. Please also make sure to enable USB Debugging mode on your device, as otherwise you can’t install and debug apps (for security reasons).
Best,
Günther
Thanks Günther,
I built the app and send the apk file via bluetooth to my mobile. I installed (allowing the usb debugging) the apk file. Now is working. I rotate my mobile app in my palm and the application always stay on portrait mode.
Kind Regards
You must be logged in to reply to this topic.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: