2010-05-31 3 views
4

나는 안드로이드 플랫폼에 아주 익숙하다. 내 서비스를 공개적으로 내보내고 싶습니다. "true"로 그들이 할 수있는 경우, 아니라면 "거짓"- 나는 개발자 문서 다른 응용 프로그램의 구성 요소가 서비스를 호출하거나 상호 작용할 수 있는지 여부android 서비스가 속성을 내 보냈습니까?

android:exported 에 뭔가를 찾을 수 있습니다. 값이 "false"이면 같은 응용 프로그램 또는 동일한 사용자 ID를 가진 응용 프로그램의 구성 요소 만 서비스를 시작하거나 바인딩 할 수 있습니다.

그러나 이해할 수 없습니다. 누구나 사용 방법에 대한 간단한 예를 보여 줄 수 있습니까?

답변

0

SampleSyncAdapter, CubeLiveWallpaper 및 VoiceRecognitionService (레벨 8의 새로운 기능) 샘플 응용 프로그램은 모두 공용으로 사용할 수 있도록 서비스를 내 보냅니다. sdk의 샘플/디렉토리를 살펴볼 수 있습니다. Eclipse는 기존 샘플 (File/New/Android Project 대화 상자)을 사용하여 새 프로젝트를 작성할 수 있습니다.

6

"내 보낸"목적은 다른 앱이 서비스에 액세스 할 수있게하는 것입니다.

예를 들어, 샘플 \ \ 안드로이드-SDK-창은 이러한 서비스와 일치하는 소스 코드는 다음 샘플

에서 폴더에서 찾을 수 있습니다 안드로이드-8 \ SampleSyncAdapter \ AndroidManifest.xml을

<service 
     android:name=".authenticator.AuthenticationService" 
     android:exported="true"> 
     <intent-filter> 
      <action 
       android:name="android.accounts.AccountAuthenticator" /> 
     </intent-filter> 
     <meta-data 
      android:name="android.accounts.AccountAuthenticator" 
      android:resource="@xml/authenticator" /> 
    </service> 
    <service 
     android:name=".syncadapter.SyncService" 
     android:exported="true"> 
     <intent-filter> 
      <action 
       android:name="android.content.SyncAdapter" /> 
     </intent-filter> 
     <meta-data 
      android:name="android.content.SyncAdapter" 
      android:resource="@xml/syncadapter" /> 
     <meta-data 
      android:name="android.provider.CONTACTS_STRUCTURE" 
      android:resource="@xml/contacts" /> 
    </service> 

\ 안드로이드 SDK-WINDOWS \

\ 샘플 \ 안드로이드-8 \ SampleSyncAdapter \ SRC \ COM 안드로이드 \ samplesync \ 인증 \ AuthenticationService.java

\ 예 \ 샘플 \ 안드로이드-SDK-WINDOWS \

이 예를 들어 \ 안드로이드 \ 안드로이드-8 \ SampleSyncAdapter \ SRC \ co.kr에서 \ \ samplesync \ syncadapter \ SyncService.java

에 위치 할 수있는이 사용하는 예 .. .

\android-sdk-windows\samples\android-8\SampleSyncAdapter\src\com\example\android\samplesync\client\NetworkUtilities.java (3 hits) 
    Line 63:   "https://samplesyncadapter.appspot.com"; 
    Line 238:    // Succesfully connected to the samplesyncadapter server and 
    Line 287:    // Succesfully connected to the samplesyncadapter server and 
관련 문제