开发者

Application priority

An application that is running for a long time in foreground will acquire more priority in time? I explain my problem. I ported a software for communication with a fixed infrastructure in Android. I'm making some tests. Each test makes 5 experiments (the mobile node sends some queries to the infrastructure and evalutes the number of query successful and the mean time) and the result of the test is the mean of the results of these experiments. During the test the application is always in foreground. In the ex开发者_StackOverflowperiments the result improve e. g. (10% 15% 30% 40% 55% of query ok). I implemented the system as activity and not yet as service. For the test the app aquire the locks SCREEN_DIM_WAKE_LOCK and WIFI_MODE_FULL. Thanks


It will not get more priority and you shouldn't do that on the ui thread.

There are several issues:

  • User can dismiss the app and your important upload process will be paused/cancel. You can do the logic to resume after a dismiss but for this case it doesn't make sense.
  • When the user dismiss the app, it might get closed by the OS.
  • You might leave the screen without updates and if that happens you will get a Force Close.
  • AFAIK in the next versions of Android if you do net logic on the ui thread you will get a FC. Similars to Gingerbread's Strict Mode.

Use a Service and spawn a thread with max priority. I am not sure if setting max priority to a thread in Android will make any difference but try it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜