Forum Stats

  • 3,814,867 Users
  • 2,258,922 Discussions
  • 7,892,882 Comments

Discussions

Android device Orientation

Brunno Dell'Agnolo
Brunno Dell'Agnolo Member Posts: 26
edited May 4, 2018 1:30PM in Mobile Application Framework

Hi,

I want to disable landscape on my App. iOS it´s ok!

How can i set Android device orientation to Portrait?

MAF - 2.5.0

JDEV - 12.2.1.3.0

Tks

Tagged:

Best Answer

  • Josh Miers, MAF-Oracle
    Josh Miers, MAF-Oracle Member Posts: 19
    edited May 1, 2018 4:38PM Answer ✓

    You can create a Cordova plugin to force portrait mode for the main MAF activity:

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

    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"

            xmlns:android="http://schemas.android.com/apk/res/android"

            id="maf-plugin-force-portrait"

            version="1.0.0">

      <name>Force Portrait</name>

      <description>MAF Force Portrait Plugin</description>

     

      <!-- android -->

      <platform name="android">

        <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='oracle.adfmf.Container']" mode="merge">

          <activity android:screenOrientation="portrait"/>

        </edit-config>

      </platform>

    </plugin>

Answers

  • Josh Miers, MAF-Oracle
    Josh Miers, MAF-Oracle Member Posts: 19
    edited May 1, 2018 4:38PM Answer ✓

    You can create a Cordova plugin to force portrait mode for the main MAF activity:

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

    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"

            xmlns:android="http://schemas.android.com/apk/res/android"

            id="maf-plugin-force-portrait"

            version="1.0.0">

      <name>Force Portrait</name>

      <description>MAF Force Portrait Plugin</description>

     

      <!-- android -->

      <platform name="android">

        <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='oracle.adfmf.Container']" mode="merge">

          <activity android:screenOrientation="portrait"/>

        </edit-config>

      </platform>

    </plugin>

  • Brunno Dell'Agnolo
    Brunno Dell'Agnolo Member Posts: 26
    edited May 2, 2018 2:27PM

    Josh,

    I added the Plugin to the src directory of my App and Registered in the maf-application.xml but the deployment failed:

    =========================================================

    [03:08:28 PM] :app:transformClassesWithDesugarForRelease FAILED

    [03:08:28 PM]

    [03:08:28 PM] FAILURE: Build failed with an exception.

    [03:08:28 PM]

    [03:08:28 PM] * What went wrong:

    [03:08:28 PM] Execution failed for task ':app:transformClassesWithDesugarForRelease'.

    [03:08:28 PM] > com.android.build.api.transform.TransformException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Oracle\Middleware\Jdev122130\oracle_common\jdk\bin\java.exe''

    [03:08:28 PM]

    [03:08:28 PM] * Try:

    [03:08:28 PM] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    [03:08:28 PM]

    [03:08:28 PM] * Get more help at https://help.gradle.org

    [03:08:28 PM]

    [03:08:28 PM] BUILD FAILED in 2m 2s

    [03:08:28 PM] 22 actionable tasks: 22 executed

    [03:08:28 PM] Deployment cancelled.

    [03:08:28 PM] ----  Deployment incomplete  ----.

    [03:08:28 PM] Failed to create the Android application.  Encountered exception: Command-line execution failed (Return code: 1). (oracle.adfmf.framework.dt.deploy.android.deployers.gradle.CreateApkFromTemplateDeployer)

  • Brunno Dell'Agnolo
    Brunno Dell'Agnolo Member Posts: 26
    edited May 4, 2018 1:30PM

    Tks @Josh Miers, MAF-Oracle

    I did a clean all and now it´s working!