List<PackageInfo> appinfo = getPackageManager().getInstalledPackages(PackageManager.GET_ACTIVITIES);
Boolean isInstalled = false;
for(int i = 0 ; i <appinfo.size() ; i ++){
PackageInfo pi = appinfo.get(i);
String appname = pi.packageName;
if(appname.equalsIgnoreCase("com.android.chrome")){
isInstalled = true;
break;
}
}
Intent i = null;
if(isInstalled){
Toast.makeText(getApplicationContext(), "chrome is installed!", 3000).show();
i = new Intent(Intent.ACTION_VIEW, Uri.parse("chrome://www.naver.com"));
} else {
Toast.makeText(getApplicationContext(), "chrome is not installed!", 3000).show();
i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.android.chrome&hl=ko"));
}
startActivity(i);
google Chrome 어플리케이션이 설치되어 있지 않으면
chrome is not installed! 토스트 후 구글 플레이스토러 크롬 다운로드 페이지로 이동 하게끔 처리 되어 있구요,
만약 설치 되어 있으면
chrome is installed! 토스트 후 크롬 브라우저를 열어 해당 url(http://www.naver.com)으로 이동하게 하고 싶습니다.
반드시 크롬 어플리케이션이여야만 하구요..
url 스키마 넘기는 법 알고 계신 분 도움 주시면 감사하겠습니다.
Uri.parse("http://m.naver.com")); 이런 식으로 넘기면 여러 브라우저 중 하나를 선택해야 하더라구요..