달력

4

« 2024/4 »

  • 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
728x90
반응형

안드로이드 - 특정 앱 설치 여부 확인 및 마켓 이동 소스

원본출처: http://blog.daum.net/satapon/111

 

- 어플목록(정확히는 패키지들) 출력하는 소스 

ArrayList<String> apps = new ArrayList<String>();
       List<PackageInfo> packs = getPackageManager().getInstalledPackages(0); 
        
       for(int j = 0 ; j < packs.size(); j++){
       apps.add(packs.get(j).packageName);
       }
       for(int j = 0 ; j < apps.size(); j++){

           Log.i("test",apps.get(j));    
       }

 

-  설치여부 확인후 없으면 마켓으로 이동하는 소스

http://baeksupervisor.tistory.com/120

 

- 안드로이드에서 마켓 링크 따기

http://jely.egloos.com/4433500

 

- 응용한 마켓 다운로드 여부 확인하는 다이얼 로그 함수

//pdf지원 어플리케이션의 마켓검색을 묻고, 종료하는 다이얼로그 호출
    public void viewPdfInstallDialog()
    {
     String alertTitle = getResources().getString(R.string.app_name);
  String buttonMessage = "현재 pdf문서를 지원하는 프로그램이 없습니다. 마켓에서 검색하시겠습니까?";//getResources().getString(R.string.alert_msg_exit);
  String buttonYes = "네";//getResources().getString(R.string.button_yes);
  String buttonNo = "아니오";//getResources().getString(R.string.button_no);
     
  new AlertDialog.Builder(LoadPDFActivity.this)
  .setTitle(alertTitle)
  .setMessage(buttonMessage)
  .setPositiveButton(buttonYes, new DialogInterface.OnClickListener() 
  {
 
   public void onClick(DialogInterface dialog, int which) 
   {
       //검색
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pdf"));
    startActivityForResult(intent, 0);
   }
  })
  .setNegativeButton(buttonNo, new DialogInterface.OnClickListener() 
  {
 
   public void onClick(DialogInterface dialog, int which) 
   {
       //종료
    finish();
   }
  })
  .show();
    }

728x90
반응형
:
Posted by mapagilove