728x90

Handler 코드를 아래와 같이 수정해야 제대로 동작된다.

Java  Handler handler = new Handler(Looper.getMainLooper());
kotlin  val handler = Handler(Looper.getMainLooper())

 

다른 앱 호출 및 실행

https://developer.android.com/training/basics/intents/package-visibility?hl=ko 참조(패키지 공개상태 관리)

안드로이드 11 에서 QUERY_ALL_PACKAGES 권한이 도입되었다.

간단하게 아래 한줄을 추가해주면 어플에서 내비 등을 호출할 때 이상없이 동작된다.

<!-- 다른 앱 실행 : SDKVersion 30 이상은 권한 추가 필요 -->
<permission android:name="android.permission.QUERY_ALL_PACKAGES" />

 

지정한 특정 앱만 실행하도록 하는 것은

<queries>
    <package android:name="kt.navi" />
    <package android:name="com.locnall.KimGiSa" />
    <package android:name="com.nhn.android.nmap" />
</queries>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.link2me.android.map">
 
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <!-- 다른 앱 실행 : SDKVersion 30 이상은 권한 추가 필요 -->
    <permission android:name="android.permission.QUERY_ALL_PACKAGES" />
 
    <queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
        </intent>
    </queries>
 
    <queries>
        <package android:name="kt.navi" />
        <package android:name="com.locnall.KimGiSa" />
        <package android:name="com.nhn.android.nmap" />
    </queries>
 
    <application
        android:name=".GlobalApplication"
        android:allowBackup="true"
        android:extractNativeLibs="true"
        android:icon="@drawable/map_icon"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true">
 
 
        <meta-data
            android:name="com.naver.maps.map.CLIENT_ID"
            android:value="@string/naver_app_key" />
        <meta-data
            android:name="com.kakao.sdk.AppKey"
            android:value="@string/kakao_app_key" />
    </application>
 
</manifest>

 

참고하면 좋은 글 : https://codechacha.com/ko/android11-package-visibility/

 

728x90
블로그 이미지

Link2Me

,