6
동적으로 응용 프로그램 아이콘을 변경하지만 사용하지 않으려면 아래 코드를 시도했습니다.android에서 APP 아이콘을 동적으로 변경하는 방법
매니페스트 :
<uses-permission android:name="com.android.launcher.action.INSTALL_SHORTCUT"/>
등급 :
내가 들어오는 메일이 Gmail 응용 프로그램처럼 에 내 응용 프로그램을 제공 할 때마다 응용 프로그램 아이콘에 카운터를 표시해야합니다Intent myLauncherIntent = new Intent();
myLauncherIntent.setClassName("your.package.name", "YourLauncherActivityName");
myLauncherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, myLauncherIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Application Name");
intent.putExtra
(
Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext
(
getApplicationContext(),
R.drawable.app_icon
)
);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);
. 그래서 어떻게 내가 응용 프로그램 아이콘을 얻을 수 & 안드로이드에서 아이콘을 동적으로 설정 ???
아,하지만 수신 메시지가 나타날 때마다 메시지의 오른쪽 상단에 카운터가 표시되어야합니다. –
@ user2436481 : 이런 종류의 배지 아이콘을 제공하는 앱 위젯을 만들 수 있습니다. 앱 아이콘 자체에는 영향을 미치지 않습니다. 더욱이, 답안에서 설명 된 접근법은 모든 홈 화면 (com.android.launcher'' Intent' 액션에 의해 입증 됨)에 의해 존중되지 않을 수도 있고, 그것을 존중하는 실행기로도 N 실행기 바로 가기를 만들 수 있습니다. – CommonsWare
@CommonsWare는 앱에 루트 액세스 권한이 있다고 가정 할 때 앱 아이콘을 동적으로 변경하는 방법을 알고 있습니까? –