Skip to content

Mobile and Embedded

The forum for developing everything embedded: Linux, WinCE, Symbian, MeeGo... you name it.
14.2k Topics 62.7k Posts
  • Qt for Android: get access to the AssetManager

    6
    0 Votes
    6 Posts
    5k Views
    W
    After a long search I found the solution in the code of Qt itself. The final result is a modification of the original code found here: [QT_SOURCE] /qtbase/src/plugins/platforms/android/src/androidjnimain.cpp. You should put the code in a cpp of the application that needs the pointer to AAssetManager. @ #include <jni.h> #include <android/asset_manager_jni.h> static JavaVM* javaVM = NULL; static AAssetManager* m_assetManager = NULL; static jclass m_applicationClass = NULL; static jobject m_activityObject = NULL; #define MY_FIND_AND_CHECK_CLASS(CLASS_NAME) clazz = env->FindClass(CLASS_NAME); if (!clazz) { qDebug() << "No se encontró la clase :("; return JNI_FALSE; } #define MY_GET_AND_CHECK_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) VAR = env->GetMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); if (!VAR) { qDebug() << "No se encontró el metodo :("; return JNI_FALSE; } #define MY_GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) VAR = env->GetStaticMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); if (!VAR) { qDebug() << "No se encontró el metodo estatico :("; return JNI_FALSE; } static int findAssets(JNIEnv *env) { jclass clazz; MY_FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative"); m_applicationClass = static_cast<jclass>(env->NewGlobalRef(clazz)); jmethodID methodID; MY_GET_AND_CHECK_STATIC_METHOD(methodID, m_applicationClass, "activity", "()Landroid/app/Activity;"); jobject activityObject = env->CallStaticObjectMethod(m_applicationClass, methodID); m_activityObject = env->NewGlobalRef(activityObject); MY_FIND_AND_CHECK_CLASS("android/content/ContextWrapper"); MY_GET_AND_CHECK_METHOD(methodID, clazz, "getAssets", "()Landroid/content/res/AssetManager;"); m_assetManager = AAssetManager_fromJava(env, env->CallObjectMethod(activityObject, methodID)); return JNI_TRUE; } extern "C" { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */reserved/) { qDebug() << "JNI_OnLoad :)"; typedef union { JNIEnv *nativeEnvironment; void *venv; } UnionJNIEnvToVoid; qDebug() << "UNION declarada :)"; UnionJNIEnvToVoid uenv; uenv.venv = NULL; javaVM = 0; if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) { qDebug() << "No hay puntero al ambiente :("; return -1; } qDebug() << "Hay puntero al ambiente :)"; JNIEnv *env = uenv.nativeEnvironment; if (!findAssets(env)) { qDebug() << "No se obtuvo puntero a al AAssetManager :("; return -1; } qDebug() << "Fuck yea!!! :)"; javaVM = vm; return JNI_VERSION_1_4; } } @
  • Compiling Qt 5.5 Beta for WEC 7

    wec7 qt 5.5 bet
    3
    0 Votes
    3 Posts
    2k Views
    T
    @SGaist Hi, thanks for the answere. I changed only this file: qt-src\qtbase\mkspecs\wince70embedded-armv4i-msvc2008\qmake.conf Only the CE_SDK define to my WEC SDK. Here is my file: include(../common/wince/qmake.conf) CE_SDK = iMX6_SABRE_SDP_WEC7_SDK # replace with actual SDK name CE_ARCH = armv4i DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH AMRV7 armv7 ARM QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /DLL /SAFESEH:NO QMAKE_LIBFLAGS_RELEASE = /LTCG QMAKE_LIBS = corelibc.lib coredll.lib QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = QMAKE_LIBS_OPENVG = libopenvg.lib QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib QMAKE_RC = rc [link text](link url) QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 QMAKE_COMPILER_DEFINES += _MSC_VER=1500 [link text](link url)
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to select wifi for ftp transfers?

    3
    0 Votes
    3 Posts
    997 Views
    H
    @PieterB Hello. QSocket class have metod which can chose web interface for connect. Use it. QFtp inheritate after QScocket.
  • Wayland Qt api, wl_display_connect("wayland-1");

    1
    0 Votes
    1 Posts
    832 Views
    No one has replied
  • 1 Votes
    3 Posts
    2k Views
    fecubF
    Connect your phone with your computer. Activate debbuging on your phone. Start DDMS on your Computer launch the application again and read the error message which is in DDMS shown. It's difficult to say what is wrong.
  • 0 Votes
    2 Posts
    828 Views
    M
    Maybe this guide will help on Windows CE: http://wiki.qt.io/Deploy_an_Application_on_Windows What error message do you get when you try to start the application?
  • Post format

    4
    0 Votes
    4 Posts
    1k Views
    M
    By the way, On server side, I can get my request value using my widget code to post . I'm just confused as why the information is different from the result by clicking the submit button on html... ="=
  • iPad crash when using flickresize.qml example

    5
    0 Votes
    5 Posts
    1k Views
    SGaistS
    Can you test again with Qt 5.5 ?
  • 0 Votes
    1 Posts
    668 Views
    No one has replied
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    1 Posts
    857 Views
    No one has replied
  • 0 Votes
    1 Posts
    539 Views
    No one has replied
  • QT on MQX RTOS (from Freescale)

    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Did you try to contact Freescale about that ?
  • Problem with QGLWidget with Android

    2
    0 Votes
    2 Posts
    1k Views
    joaopagottoJ
    Solved in Qt 5.4 =D
  • Notification in iOS

    2
    0 Votes
    2 Posts
    731 Views
    A
    Do you mean push notifications or local notifications triggered locally within your app? They both have to be implemented in iOS native Objective-C code as of now. If you're not familiar with that you probably also might have a look at our plugins for such use cases at http://plugin.v-play.net. Best, Alex from V-Play
  • This topic is deleted!

    Locked
    0
    0 Votes
    0 Posts
    65 Views
    No one has replied
  • "program received signal -111" Fatal error on iOS

    ios signal
    7
    0 Votes
    7 Posts
    3k Views
    N
    Normally it calls others functions which manages the display, the first sequence receives datas from a bluetooth connection, the second sequence creates objects and displays them, the third one modifies them and the fourth one returns its value if it's changed by the user. For example, if I want to display a line Edit : I send a bluetooth trame with the instruction, the first sequence memorizes it, Then, in the second sequence, I create it and add it on the mainwindow, I add a texte and I modify some properties (like alignment, color, ...) in the third sequence, Finally, if the user change its text value, the fourth sequence returns the new one by bluetooth when the signal editingFinished() return true PS : Actually, I don't use bluetooth yet, I only fill an array which stand for buffer but after my tests are effective it will be replace by Bluetooth Low Energy
  • Qt Development Folder Structure

    5
    0 Votes
    5 Posts
    1k Views
    K
    @SGaist Thanks Sam! I understand.
  • How to use Qt with Windows 10 IoT Core (intel x86)?

    qt5 windows 10 iot
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied