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