代码之家  ›  专栏  ›  技术社区  ›  Vlad Tsepelev

禁用黑莓风暴上的加速度计

  •  2
  • Vlad Tsepelev  · 技术社区  · 16 年前

    我为黑莓开发应用程序。在Storm 1(4.7)和Storm 2(5.0)中,我需要在应用程序中禁用加速度计。我希望我的应用程序不会对加速度计做出反应,但这不会影响其他应用程序。有可能吗?

    1 回复  |  直到 16 年前
        1
  •  5
  •   Maksym Gontar    16 年前

    无法禁用加速度计,但可以锁定屏幕方向更改:

    // To force portrait view in a BlackBerry API application,
    // use code like this before invoking UiApplication.pushScreen()
    int directions = Display.DIRECTION_NORTH | Display.DIRECTION_SOUTH;
    Ui.getUiEngineInstance.setAcceptableDirections(directions);
    

    参见 Specifying the orientation and direction of the screen

    推荐文章