Home 앱 아이콘이 런처에 보이지 않는 문제
Post
Cancel

앱 아이콘이 런처에 보이지 않는 문제

앱 아이콘이 런처에 보이지 않는 문제

Github OAuth를 적용하기 위해 처음에 아래처럼 intent-filter 를 구성했다. 그런데 적용한 후 실행해보니 앱의 아이콘이 앱 런처에 나타나지 않았다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<activity
    android:name=".presentation.login.LoginActivity"
    android:exported="true"
    android:launchMode="singleTask">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="com.example.it.issuetracker"
            android:scheme="issuetracker" />
    </intent-filter>
</activity>

그래서 찾아본 결과, 아래와 같이 intent-filter 를 따로 구성해야 한다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<activity
    android:name=".presentation.login.LoginActivity"
    android:exported="true"
    android:launchMode="singleTask">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="com.example.it.issuetracker"
            android:scheme="issuetracker" />
    </intent-filter>
</activity>

먼저 인텐트 태그들에 대해서 간단히 얘기하자면 아래와 같다.

action.MAIN : 앱의 진입점을 의미

category.LAUNCHER : 앱 아이콘을 런처에 표시해주기 위함

BROWSABLE : 앱 내부에서 브라우저를 열 수 있다. 이때 특정 앱의 intent-filterdata 태그가 존재한다면 해당 앱의 액티비티를 띄울 수도 있다. (딥 링크 이용)

관련 내용 : https://developer.android.com/training/app-links/verify-site-associations?hl=ko


위와 같이 사용해야하는 이유에 대해서 명확히 설명된 글이 없어서 여러 시도 끝에 나만의 결론을 내리자면, 암시적 인텐트 필터는 앱이 실행중이지 않더라도 요청이 들어오면 데이터를 받아 실행해야 한다. 그래서 BROWSABLE 이 설정된 인텐트 필터는 Instant 앱으로 실행되어야 하기 때문에 시스템 어딘가에 숨겨져 있고, 요청이 들어오면 숨겨진 해당 인텐트를 실행해주는 과정을 거치는 것 같다.

PackageParser.java 어딘가..

PackageParser.java 어딘가..


그래서 MAINLAUNCHER 가 선언된 intent-filterBROWSABLE 을 추가하게 되면 앱 아이콘이 런처에서 사라지는게 아닌가 싶다.

실제로, 위 manifest.xml 파일에서 launchModesingleTask (앱이 실행되어 있으면 실행된 앱을 이용함) 로 설정되어 있는데, 이를 제거하게 되면 이미 앱이 실행되어 있더라도 해당 앱을 계속 사용하는 것이 아니라 새로운 앱을 실행하게 된다.

제거 전

1
D/test: onCreate

제거 후

1
2
D/test: onCreate
D/test: onCreate
This post is licensed under CC BY 4.0 by the author.

[프로그래머스] 도둑질

-

Comments powered by Disqus.