'getSystemSharedLibraryNames'에 해당되는 글 1건

  1. 2013.03.07 단말기에(주로 tablet) 설치된 library에 따라 동적으로 처리하기.

단말기에(주로 tablet) 설치된 library에 따라 동적으로 처리하기.

android 2013. 3. 7. 13:46

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

작성일 : 2013-03-07

작성자 : hanburn

 

안드로이드의 단말기는 참 다양한걸 체감한다. 일본에서 판매되는 LuvPad 라는 안드로이드 타블렛이 있는데, 이 단말기는 google library 가 탑재되어 있지 않다. 모두 알고 있는 것이지만 구글에서 인증받지 않은 단말기는 구글 모듈( 구글 Play, 구글지도등)의 기본 앱들이 설치되어 있지 않다.

앱을 개발하다보면, 위처럼 여러 단말을 고려해서 개발을 해야 하므로 설치는 모두 가능하고 하하 실행할 때 동적으로 단말기에 해당 기능이 있는지 체크해서 처리하면 좋을 것이다.

 

간단한 구글지도를 예로 들어서 설명하겠다.

일단 모두 설치되도록 하려면 AndroidManifest.xml 파일에서 아래처럼 false로 되어 있는지 확인한다.

<uses-library android:name="com.google.android.maps" android:required="false"/>

 

다음으로는 실행되는 순간에 구글지도기능이 있는지 체크해야 한다.  간단하게 아래와 같은 함수를 하나 만들었다.

public boolean hasSystemSharedLibraryInstalled(Context ctx, String libraryName) {

           boolean hasLibraryInstalled = false;

           if (!TextUtils.isEmpty(libraryName)) {

               String[] installedLibraries = ctx.getPackageManager().getSystemSharedLibraryNames();

               if (installedLibraries != null) {

                   for (String s : installedLibraries) {

                       if (libraryName.equals(s)) {

                           hasLibraryInstalled = true;

                           break;

                       }

                   }

               }

           }

           return hasLibraryInstalled;

       }

 

구글지도는 MapActivity를 이용하므로 해당 Activity를 시작하기 전에 아래처럼 체크하면 된다.

hasSystemSharedLibraryInstalled(context, “com.google.android.maps”);

 

 

아래는 getSystemSharedLibraryNames 함수를 이용해서 AVD 개발폰에서 해당정보를 추출해봤다.

  

AVD에 설치된 목록 (android - 4.0 library  API level 14 )

android.test.runner

com.android.location.provider

javax.obex

정말 간단하다.

 

AVD에 설치된 목록 (Google APIs – 4.2 level 17 )

android.test.runner

javax.obex

com.google.android.media.effects

com.google.android.maps

com.android.future.usb.accessory

com.android.location.provider

 Map과 위치정보 제공자 모듈이 추가로 들어있는 것을 알수 있다.

 

HTC desire에 설치된 목록 ( android 2.3 )

com.ecrio.sip

com.htc.transcoder

javax.obex

com.android.future.usb.accessory

com.htc.htcSceneManager

com.htc.framework

android.test.runner

com.htc.android.pimlib

com.htc.lockscreen.fusion

com.scalado.util.ScaladoUtil  -> MWC 2012때 전시된 스칼라도의 라이브러리를 사용했나 ㅋ ?

com.htc.android.easopen

com.google.translate

com.htc.sunny2

com.htc.fusion.fx

com.orange.authentication.simcard

com.google.android.maps

com.android.location.provider

com.htc.android.rosie

~ 정말 많은 것들이 있네~ 

com.htc.xxx 모듈은 제조사에서 android를 커스터마이징하면서 추가한 기능들 같아 보이고,

그외 third-party 의 모듈로 추정되는 것들도 보이네요.

 

 



: