Posts

Showing posts with the label Android

Qt: Request Android app permissions

Image
Each Android app, based to the "interaction" with system, have to declare what resources need to access through some special info called permissions . Normally these permission are declared inside the AndroidManifest.xml and this was enough. However, from android version 23 (Marshmallow) and above some part of these permissions (classified as more "critical") have to be manually requested to the user who have to accept for authorize the app to use it.

Android: Remove system app from adb command line

Image
In case you want to remove from your android a system app is possible to use few commands using adb but remember you need to have a rooted device for get it working

QML: Get Android apk package info

Image
All the information stored inside apk AndroidManifest.xml file can be extracted using dedicated Android API. Using JNI through C++ Qt layer is possible to get these info and pass them to the QML level.

QML: Mixed native Android and QML animated splash screen

Image
In this blog two methods for show a splash screen has been proposed. One is based to pure QML code and show animations and the second is native Android way but static. Now a third method mixing both previous solution by allow a partially animated splash screen is proposed.

QML: Change Android screen orientation programmatically

Image
In case your Android app require to dynamically set screen orientation for some particular interface is possible to directly call the system API allowing to choose one of the two standard orientations LANDSCAPE or PORTRAIT.

Android: adb push and read-only file system error

Image
If you want to copy a file from your PC to the connected android device the fasten way is to use adb tool with push command. This command get as params the path of the local file and the remote path to copy in the device. Sometimes, especially if you use adb from Windows or MacOS, and error about read-only file system show up and you can not copy any file.

Java and https invalid certification error

Image
In case you are working under a restricted network with some particular proxy who have its own secure certificate system is possible you experiment some problem when Java runtime try to download something from an https address. Developing with Android Studio can show the problem cause try to download gradle package at first compilation.

Make Android/iOS resized icons package online

Image
Major mobile systems require you provide a set of image of same icon resized to support different DPI screens. This is a very boring step in develop your app but fortunately it exist some tool able to automatically make the job for us.   

Store and retrieve Android contacts photo

Image
Android default contacts are, basically, a database for store and retrieve phone contacts info. Here a short snippets showing a way to store and retrieve the photo of the contacts. Android contacts store photo in two format, large and thumbnail with two different way for retrieve it.

QML: Show Android native splash screen in your QML app

Image
In this post a solution to make a pure QML splash screen has been proposed and could be used for Android app also. However, since Qt/QML app are "wrapped" inside pure Android code a solution like these could be a little slow especially in the first step of application startup. Here another solution specific for Android app more faster to show splash screen at startup.

QML: Get Android signal strength level

Image
Second post regarding how to get system info from Android to QML. This post will analyze the way to install an Android listener to be advised when phone signal strength level change.

QML: Get Android battery level and status

Image
This post will explain a way to get Android battery level and status from QML. To be more precise will explain the way to install a sort of listener that will automatically advise the QML layer about changes in level of battery charge and the status of the phone (if on charge or not).

QML: Resize controls when Android virtual keyboard come up

Image
QML have currently a bug (current version 5.8 still have) in resize window when android keyboard come up. It happen when virtual keyboard is requested the QML window show a bad flicker by repaint the top control on the center of the screen and back on top again. This look really unprofessional.

QML and Android emulator OpenGL error

Image
Lately, after an Android emulator image update, a strange error regarding OpenGL is coming up using official Android emulator. This error refer to some OpenGL failed operation and, as consequence, doesn't allow the app to run correctly. QML make a large use of OpenGL that's mean each app developed using this technology doesn't work anymore (on the emulator).

Qt Creator: include additional files inside Android apk

Image
Developing an app for Android frequently require to include some additional files containing custom data used by the app itself (in majority of cases sqlite database files). Android provide a standard way by using a special folder called assets where these kind of files need to be stored. Qt Creator provide a instructions to use for copy these files during apk creation.

QML: Manage application state on mobile systems

Image
Develop app for mobile systems like Android or iOS require some additional steps compared to standard Desktop systems. One of the most important is to correctly manage the state change of your app. This is critical for avoid the app to consume CPU and battery when is not required.

QML and Android back button

Image
QML and Qt Quick controls allow a very rapid development also mainly for mobile devices. However mobile devices require some additional code for manage special system buttons. In this post we discuss about how to manage the Android back button using QML.

Compile QWebKit component for Android

Image
As announced Qt team ported Qt libraries to work on mobile system also but with some limitations. The most "important" limitation (in my opinion) is the choice to not include QWebKit (or QtWebEngine) component into mobile system library set. As replacement of this lack Qt team provide the QtWebView component that is a wrapper around the system native web browser engine.

Launch an app from Android shell terminal

Image
If you want to launch an Android app from shell command line terminal there is a simply command allow to do that but you have to know some info about the app you want to execute. The command is named am and is basically a command line interface to the system ActivityManager .

Configure Android emulator to go through a proxy

Image
If you are developing an Android app and need the emulator to access Internet you can get the result in case of your network is under a proxy. The emulator interface doesn't have some GUI dialog allow to insert proxy params but there is a way to set these params by command line. This mean you have to manually launch the emulator instead of have it automatically started by the IDE.