Android Studio 2.1.2
Target SDK 24 ( Android 7.0 Nougat)
getLaunchIntentForPackage()를 사용하면 간단하게 구현할 수 있으며, API레벨 3이라 저사양 폰도 걱정 없을 듯하다.
구현방법은 아래 소스를 참고하면 된다.
찾는 앱이 없을 경우 Play Store로 이동하며, 있을 경우 해당 앱을 실행하는 소스이다.
PACKAGE_NAME는 단말기내에 찾을 앱 패키지명을 넣어 주면 된다.
1 2 3 4 5 6 7 8 | Intent launchIntent = getPackageManager().getLaunchIntentForPackage("PACKAGE_NAME"); if (launchIntent == null) { // 단말기 내에 어플리케이션(앱)이 설치되어 있지 않음. Intent intent = new (Intent.ACTION_VIEW, Uri.parser("market://details?id=" + "PACKAGE_NAME")); startActivity(intent); // 앱이 설치되어 있지 않은 경우 Play스토어로 이동 } else { // 단말기 내에 어플리케이션(앱)이 설치되어 있음. startActivity(launchIntent); // 앱이 설치되어 있으면 앱 실행. } | cs |
Android Log 표시(Log 짤림 현상 개선) (0) | 2017.12.04 |
---|---|
android 디바이스에 저장된 연락처 가져오기 (0) | 2017.10.17 |
android Status Bar 색상 변경 (0) | 2017.09.05 |
android '최근 실행 목록'에서 실행 시 구분 (0) | 2016.12.05 |
android SpannableStringBuilder (0) | 2016.12.05 |
댓글 영역