More fixes for OpenPgpServiceConnection

This commit is contained in:
Dominik Schürmann 2014-08-12 14:38:28 +02:00
parent cbfeb90cec
commit 9e1f732b23

View file

@ -16,14 +16,14 @@
package org.openintents.openpgp.util;
import org.openintents.openpgp.IOpenPgpService;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import org.openintents.openpgp.IOpenPgpService;
public class OpenPgpServiceConnection {
// callback interface
@ -99,8 +99,11 @@ public class OpenPgpServiceConnection {
Intent serviceIntent = new Intent(OpenPgpApi.SERVICE_INTENT);
// NOTE: setPackage is very important to restrict the intent to this provider only!
serviceIntent.setPackage(mProviderPackageName);
mApplicationContext.bindService(serviceIntent, mServiceConnection,
boolean connect = mApplicationContext.bindService(serviceIntent, mServiceConnection,
Context.BIND_AUTO_CREATE);
if (!connect) {
throw new Exception("bindService() returned false!");
}
} catch (Exception e) {
if (mOnBoundListener != null) {
mOnBoundListener.onError(e);