Created
December 27, 2016 14:10
-
-
Save suhanlee/23a213de44468bf3ffcca038cc06769e to your computer and use it in GitHub Desktop.
Android Launcher Badge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Samsung --> | |
<uses-permission android:name="com.sec.android.provider.badge.permission.READ" /> | |
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" /> | |
<!-- Sony --> | |
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" /> | |
<!-- HTC --> | |
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" /> | |
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compile 'com.github.arturogutierrez:badges:1.0.5@aar' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setAppBadgeCount(String badgeCount) { | |
// 기본 런처 규칙 앱 뱃지 반영 | |
Intent intent = new Intent("android.intent.action.BADGE_COUNT_UPDATE"); | |
// Package name, Class name(App의 launcher class의 이름) 설정 | |
intent.putExtra("badge_count_package_name", getPackageName()); | |
intent.putExtra("badge_count_class_name", getComponentName().getClassName()); | |
// Count 설정 | |
intent.putExtra("badge_count", Integer.parseInt(badgeCount) ); | |
sendBroadcast(intent); | |
// 다른 런처 규칙 앱 뱃지 반영 | |
try { | |
Badges.setBadge(getApplicationContext(), Integer.parseInt(badgeCount)); | |
} catch (BadgesNotSupportedException badgesNotSupportedException) { | |
Log.d(TAG, badgesNotSupportedException.getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment