189 8069 5689

Libgdx解决部分Android机型锁屏崩溃的方法-创新互联

libgdx使用了全屏模式之后,在某些机型会出现崩溃的情况,两年前就存在了,一直到现在为止,官方都没进行修复,其崩溃原因就是在源码AndroidGraphics.java中的onPause可以看到这样子的一段代码:

创新互联是专业的嘉峪关网站建设公司,嘉峪关接单;提供成都网站建设、成都网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行嘉峪关网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
void pause () {
    synchronized (synch) {
      if (!running) return;
      running = false;
      pause = true;
      while (pause) {
        try {
          // TODO: fix deadlock race condition with quick resume/pause.
          // Temporary workaround:
          // Android ANR time is 5 seconds, so wait up to 4 seconds before assuming
          // deadlock and killing process. This can easily be triggered by opening the
          // Recent Apps list and then double-tapping the Recent Apps button with
          // ~500ms between taps.
          synch.wait(4000);
          if (pause) {
            // pause will never go false if onDrawFrame is never called by the GLThread
            // when entering this method, we MUST enforce continuous rendering
            Gdx.app.error(LOG_TAG, "waiting for pause synchronization took too long; assuming deadlock and killing");
            android.os.Process.killProcess(android.os.Process.myPid());
          }
        } catch (InterruptedException ignored) {
          Gdx.app.log(LOG_TAG, "waiting for pause synchronization failed!");
        }
      }
    }
  }

网站名称:Libgdx解决部分Android机型锁屏崩溃的方法-创新互联
链接分享:http://cdxtjz.com/article/dooghe.html

其他资讯