视频播放询问安全计时器重置

发布于 2024-10-20 06:12:22 字数 589 浏览 1 评论 0原文

我正在开发一个可以播放视频的黑莓应用程序。视频第一次开始播放(工作正常)时,它会出现一个对话框,询问

“应用程序 xyz 正在尝试重置安全计时器。”

复选框:

不再询问

以及选项 允许/拒绝

如果选择允许并选中复选框,则下次播放视频时不会出现问题。但这是否是在视频播放之前消除此安全计时器问题的方法?

是相关的或RIM 支持网站上有同样的问题

I am developing a BlackBerry app which can play video. The first time the video starts playing (works fine) it asks with a dialog,

"The application xyz is attempting to reset the security timer. "

Checkbox:

Do not ask again

And the option
Allow / Deny

If allow is choosen and the checkbox selected, the video plays without problem the next time. But is it a way to remove this security timer question before the video is even played?

This is a related or same issue over at the RIM support site.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

银河中√捞星星 2024-10-27 06:12:23

您看到的对话框是操作系统提示用户授予您的应用程序对受限 API 调用的权限。即使您没有直接在代码中重置安全计时器,它也会作为应用程序的一部分代表您完成。处理此问题的最佳方法是在用户第一次运行您的应用程序时提示用户获得许可。

下面是提示用户所有权限的示例方法。您应该在应用程序第一次运行时调用它。您可以通过调用 permRequest.addPermission( int Permission ) 来仅选择您需要的权限,从而在提示的内容中进行更多选择。例如传递ApplicationPermissions.PERMISSION_IDLE_TIMER。

private static void assertHasPermissions() 
  {
    // Capture the current state of permissions and check against the
    // requirements.
    ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
    ApplicationPermissions original = apm.getApplicationPermissions();
    ApplicationPermissions permRequest = new ApplicationPermissions();
    int[] permissions = original.getPermissionKeys();
    for ( int i = 0; i < permissions.length; i++ ) 
    {
      permRequest.addPermission( i );
    }
    apm.invokePermissionsRequest( permRequest );
  }  

http://supportforums.blackberry.com/t5/Java-Development/Enable-the-backlight-and-prevent-the-BlackBerry-device-screen/ta-p/444706

The dialog you are seeing is the OS prompting the user to grant your application permission to a restricted API call. Even though you are not directly resetting the security timer in your code, it is being done on your behalf as part of your app. The best way to handle this is to prompt the user for permission the first time the user runs your app.

Below is a sample method that prompts the user for all permissions. You should call this the first time your application runs. You could be more selected in what you prompt for by calling permRequest.addPermission( int permission ) for only the permissions that you need. For example pass ApplicationPermissions.PERMISSION_IDLE_TIMER.

private static void assertHasPermissions() 
  {
    // Capture the current state of permissions and check against the
    // requirements.
    ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
    ApplicationPermissions original = apm.getApplicationPermissions();
    ApplicationPermissions permRequest = new ApplicationPermissions();
    int[] permissions = original.getPermissionKeys();
    for ( int i = 0; i < permissions.length; i++ ) 
    {
      permRequest.addPermission( i );
    }
    apm.invokePermissionsRequest( permRequest );
  }  

http://supportforums.blackberry.com/t5/Java-Development/Enable-the-backlight-and-prevent-the-BlackBerry-device-screen/ta-p/444706

顾铮苏瑾 2024-10-27 06:12:23

这只是一个猜测...

可能是当您开始播放视频时,操作系统会假设有一个重置安全计时器的请求,以便设备在视频播放时不会锁定。如果您让我们知道您正在运行的设备软件版本以及您正在使用的 API 版本,可能会更容易确定。

This is just a guess...

It may be that when you start playing the video, the OS assumes a request to reset the security timer so that the device will not lock while the video is playing. It may be easier to be sure if you let us know what version of the device software you are running, and what version of the API you are programming with.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文