2013-07-31 7 views
2

서비스를 포함하는 기본 앱과 해당 서비스를 사용하려는 두 번째 앱이 있습니다. 내가 바인딩하려고 두 번째 응용 프로그램에서Android의 다른 앱에서 내 보낸 서비스 사용하기

<service 
    android:name="com.example.foo.XMPPService" 
    android:exported="true" 
    android:process="xmppService" /> 

:

주요 응용 프로그램은 매니페스트 (안 활동 내부)이있다

Intent intent = new Intent(); 
intent.setClassName("com.example.foo", "com.example.foo.XMPPService"); 
bindService(intent, mConnection, Context.BIND_AUTO_CREATE); 

을하지만 난 오류가 발생합니다 :

Unable to start activity ComponentInfo{com.example.app2/com.example.app2.MainActivity}: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=com.example.foo/.XMPPService } 

그래서 "내 보낸"을 true로 설정하는 동안 이것이 허용되지 않는 이유가 궁금합니다.

답변

3

당신은 문서에서 소문자로 android:process을 시작 : 당신은 혼자가이 태그를 떠날 경우

If the process name begins with a lowercase character, the service will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

이 서비스는 응용 프로그램의 일부가 될 것입니다. 당신이 그것을 망쳐 버리기 시작하자 마자, 그것은 스스로를위한 과정을 창조 할 것입니다. 이 전역 프로세스는 시스템 사용자로 실행되며 플랫폼 인증서로 서명해야합니다.

+0

아, 그 텍스트를 잘못된 방식으로 해석합니다. 'android : process = "XMPPService"'를 시도하고 제거했지만 여전히 같은 문제가 있습니다. 그것을 올바르게하는 방법에 대한 제안? – vliedel

관련 문제