2014-04-08 35 views
4

我有一個aidl服務,它可以正常工作,直到客戶端安裝之前安裝主機,但正如我在標題中提到的,當主機不是安裝和我安裝客戶端之後,我安裝主機我得到bindService()android aidl無法綁定到服務,當主機安裝在客戶端後

Intent serviceIntent = new Intent(AidlService.class.getName()); 
if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) { 
    mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); 
} 

Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.mypackage.AidlService} 

我還測試了使用AIDL幾個應用一個SecurityException和他們有同樣的問題!

UPDATE

我想通了,問題是許可, 我的服務使用客戶端安裝在主機前無法理解權限的自定義權限,所以當我安裝主機並嘗試綁定到它,android無法使用權​​限,因此它會引發安全異常!

android:permission="com.mypackage.AidlService.BIND" 

<permission android:name="com.mypackage.AidlService.BIND" 
      android:label="@string/perName" 
      android:description="@string/perDesc" 
      android:protectionLevel="normal" /> 

任何想法來解決這個問題?

+0

http://stackoverflow.com/questions/12007139/not-allowed-to-bind的ProtectionLevel = 「簽名」 來代替正常 對服務意圖 – Raghunandan

+0

它沒有工作。 – hister

+0

好問題,我也被這個卡住了。找不到答案。 –

回答

相關問題