마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

백그라운드 어플이 실행되는 우선순위도 정해줄 수 있나요?

+1 추천
백그라운드 어플 죽이는 어플(배터리, 메모리 아껴주는 어플?)로 백그라운드 어플들을 싹 죽인 후, 다시 실행되는 순서를 보면

제가 만든 백그라운드어플은 늦으면 5분넘게 걸린 후 실행되던데.. 페이스북, 캐시슬라이드 같은 앱은 정말 5초도 안걸리고

바로 재실행 되더라구요.. 이러한 우선순위도 정해줄 수 있는건가요?
익명사용자 님이 2015년 4월 14일 질문
아 찾았습니다...<intent-filter android:priority="9999999999999999999999999999999999999999999999999999999999999999"> <!-- 우선순위 -->
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>

이처럼 우선순위를 퍼미션에서 설정해줄 수 있었습니다ㅎㅎ

근데 궁금한건 위처럼 9999999999999와같이 제한되는 범위는 없는건가요?

1개의 답변

+1 추천

그 인텐트 필터의 priority 는 그런 의미가 아닐텐데요..

그리고 값은 -999 ~ 999 사이로 줄 수 있다고 나와있네요

android:priority
The priority that should be given to the parent component with regard to handling intents of the type described by the filter. This attribute has meaning for both activities and broadcast receivers:
  • It provides information about how able an activity is to respond to an intent that matches the filter, relative to other activities that could also respond to the intent. When an intent could be handled by multiple activities with different priorities, Android will consider only those with higher priority values as potential targets for the intent.
  • It controls the order in which broadcast receivers are executed to receive broadcast messages. Those with higher priority values are called before those with lower values. (The order applies only to synchronous messages; it's ignored for asynchronous messages.)

Use this attribute only if you really need to impose a specific order in which the broadcasts are received, or want to force Android to prefer one activity over others.

The value must be an integer, such as "100". Higher numbers have a higher priority. The default value is 0. The value must be greater than -1000 and less than 1000.

 

Gradler (109,780 포인트) 님이 2015년 4월 14일 답변
...