[SOLVED] Idle mode using native sdk



  • Hello,
    I am in process of creation of an app using Qt 5.2.1 so I cannot rely on Official BB Qt components.
    So, as I have done for vibration (that works), I am trying to do the same for screen idle, but without success; this is my code (extracted on official bb example):
    @
    screen_context_t screen_ctx;
    screen_window_t window_id;

    screen_create_context(&screen_ctx, SCREEN_APPLICATION_CONTEXT);
    screen_create_window(&window_id, screen_ctx);
    

    screen_set_window_property_iv(window_id, SCREEN_PROPERTY_IDLE_MODE,SCREEN_IDLE_MODE_KEEP_AWAKE);
    screen_destroy_window(window_id);
    screen_destroy_context(screen_ctx);
    @

    This doesn't work!



  • For those who need to work this job out, you can just use:
    @
    int idle = inhibit ? SCREEN_IDLE_MODE_KEEP_AWAKE : SCREEN_IDLE_MODE_NORMAL;

    screen_set_window_property_iv((screen_window_t)myWinId, SCREEN_PROPERTY_IDLE_MODE, &idle);
    @

    myWinId is just a QWindow's function (inherited by QQuickWindow, QmlApplicationViewer and so on...)


Log in to reply