Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- mybatis
- react
- 보조정렬
- GIT
- window
- NPM
- table
- Android
- JavaScript
- es6
- Kotlin
- MSSQL
- SQL
- Spring
- SPC
- Python
- vaadin
- mapreduce
- Eclipse
- SSL
- tomcat
- 공정능력
- plugin
- IntelliJ
- R
- Express
- xPlatform
- Sqoop
- hadoop
- Java
Archives
- Today
- Total
DBILITY
android shortcut 본문
반응형
<uses-permission android:name="android.permission.INSTALL_SHORTCUT" />
퍼미션은 없어도 되는 것 같은데
SharedPreferences sharedPreferences = getSharedPreferences("FIRST_LAUNCH", Context.MODE_PRIVATE);
if (sharedPreferences.getBoolean("FIRST_LAUNCH", true)) {
sharedPreferences.edit().putBoolean("FIRST_LAUNCH", false).commit();
if (ShortcutManagerCompat.isRequestPinShortcutSupported(this)) {
ShortcutInfoCompat shortcutInfoCompat = new ShortcutInfoCompat.Builder(this, "#0")
.setIntent(new Intent(this, RetrofitActivity.class)
.setAction(Intent.ACTION_MAIN))
.setShortLabel(getString(R.string.app_name))
.setIcon(IconCompat.createWithResource(this, R.drawable.icon))
.build();
ShortcutManagerCompat.requestPinShortcut(this, shortcutInfoCompat, null);
Toast.makeText(this, "바로가기가 생성되었습니다", Toast.LENGTH_SHORT).show();
}
}
반응형
'android > java' 카테고리의 다른 글
android downloded apk file version check and install (0) | 2024.05.09 |
---|---|
android progress bar color change programmatic (0) | 2024.05.08 |
WindowMetrics 화면 크기 등 (0) | 2024.05.04 |
android.nonFinalResIds=false (0) | 2024.04.17 |
Didn't find class "androidx.core.app.CoreComponentFactory" (0) | 2024.04.16 |
Comments