Qt for Android's AndroidManifest.xml Detailed

First, create a file AndroidManifest.xml

Very simple, there are pictures and the truth ......
Here Insert Picture Description

Second, the introduction AndroidManifest.xml file

Or the first figure
Here Insert Picture Description
1, the top of the red wavy line marking the position of the source can be switched to an xml;
2, the page on three major GroupBox, respectively, the Package , the Application , the Permissions .

The following three major say this:
Package Penalty for :

  • package name: package name, the default seems to be org.qtproject.example, very casual. But if you develop multiple qt android projects on the same machine android, the best is still to distinguish from naming the package name under cover or will occur.

Description: There prior to that did not care, recently saw this blog says, java class source address you need to create the project in the package and there were countless relation. Means that your java file should be placed under the android / src / org / qtproject / example / file. But it not before I do so, as my java file path is android_sources / src / com / qt / usejava, is also possible. So he's saying this I went to verify the verification ......

  • Version code and Version name: This is the app version number to help you do version control;
  • Minimum required SDK and Target SDK: Freeze change this thing, I think before my camera system is Android 8.0, I'll change the Target SDK to Android 8.0. Then tragedy, screen brightness adjustment function does not work ...... or change it back neatly enough. ……embarrassed

Application

  • Application name: it seems no use, I tried;
  • Activity name: App name can be in English, Chinese, digital;
  • Run: This must be the project name! ! !
  • Application icon: App icon three pixel size (LDPI, MDPI, HDPI).

permissions

  • add and remove: This goes without saying it, manually add and delete permissions android. (This is a static permissions apply)

Description: Android6.0 and above systems, some permissions are required dynamic application. What specific, when you used to know.

/*************************************************
 <函数名称>    request_Android_Permission
 <功    能>   动态申请android权限
 <参数说明>    str_permission: 具体权限
 <返回值>     是否成功
 <函数说明>   **注意:该函数只能在QT5.10版本及以上才能使用。**
 <作    者>   mcq
 <时    间>   20181201
**************************************************/
bool request_Android_Permission(const QString &str_permission)
{
#ifdef Q_OS_ANDROID
    QtAndroid::PermissionResult r = QtAndroid::checkPermission(str_permission);
    if(r == QtAndroid::PermissionResult::Denied)
    {
        QtAndroid::requestPermissionsSync( QStringList() << str_permission );
        r = QtAndroid::checkPermission(str_permission);
        if(r == QtAndroid::PermissionResult::Denied)
        {
            return false;
        }
    }
    return true;
#else
    return false;
#endif
}

If your Qt version is relatively low, you can take a look at this article ......


OtherSometimes necessary to force the operating App horizontal screen or the like:
the source is switched to the state AndroidManifest.xml, ctrl + f Find "android: screenOrientation", and then to set the modified: android: screenOrientation = "sensorLandscape"
further may alternative settings as follows:
"Unspecified": the default value is determined by the display direction determination system is the policy and related apparatus, so that different devices have different display directions..
"Landscape": cross-screen display (aspect ratio Gaoyao long)
"Portrait": vertical screen display (longer than wide)
"the user": the user's current preferred direction
"behind": the Activity and direction consistent with the following Activity () in the Activity stack
"sensor ": physical sensors to decide. If the user rotates the device this screen will switch the screen anyway.
"Nosensor": Ignore physical sensors, so as not to change the user rotates the device ( "unspecified" setting except).
----------------

Reference article:
https://blog.csdn.net/luoyayun361/article/details/72993841
http://www.kokojia.com/article/17626.html
https://www.cnblogs.com/warmSnowFY/p/9542376 .html

Published 32 original articles · won praise 4 · Views 3387

Guess you like

Origin blog.csdn.net/qq_35241071/article/details/101051259