자바
final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
코틀린
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")))
} catch (e: ActivityNotFoundException) {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$packageName")))
}
'안드로이드 > 잡다한 지식' 카테고리의 다른 글
Android Unable to create call adapter for retrofit2 (0) | 2022.10.25 |
---|---|
안드로이드 NetworkInterface (1) | 2022.10.05 |
안드로이드 핫스팟 켜기 (0) | 2022.10.05 |
안드로이드 재시작 코드 (0) | 2022.10.05 |
안드로이드 Doze 모드 정리 (0) | 2022.05.16 |