First of all I have read all of the questions with this title but non of them helps me :-(
I have to connect to a base app with my client app and using a permission. If I install client app first and then the base app I get above exception. how can I solve this? If I remove my client app and install it again the issue is solved but how can I tell this to my customers, how can I prevent them from installing client app if the base app has not installed?
at Mypackage.IssueFirstLookActivity.onCreate(IssueFirstLookActivity.java:443) is:
mHelper.startSetup(new OnIabSetupFinishedListener()
at Mypackage.IabHelper.startSetup(IabHelper.java:269) is (mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);)
List<ResolveInfo> queryIntentServices = mContext.getPackageManager().queryIntentServices(serviceIntent, 0);
if (queryIntentServices != null && !queryIntentServices.isEmpty()) {
// service available to handle that Intent
mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
}
and
mHelper = new IabHelper(this,mBase64EncodedPublicKey);
if(myContext.getState() == MyContext.LOGIN_HAS_NOT_PURCHASED_STATE ){
// if(1==1){
mHelper.startSetup(new OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(IabResult result) {
// if we were disposed of in the meantime, quit.
if (mHelper == null) return;
if (!result.isSuccess()) {
// Oh noes, there was a problem.
Log.d(TAG, "Problem setting up In-app Billing: " + result);
Toast.makeText(IssueFirstLookActivity.this, "Error " + result.toString() ,Toast.LENGTH_LONG).show();
// TODO user has not bazaar
}else{
// Hooray, IAB is fully set up!
// TODO my new thing
//mHelper.queryInventoryAsync(mGotInventoryListener);
}
}
});
Stack trace:
04-10 10:44:42.170: E/AndroidRuntime(2316): FATAL EXCEPTION: main
04-10 10:44:42.170: E/AndroidRuntime(2316): java.lang.RuntimeException: Unable to start activity ComponentInfo{Mypackage.IssueFirstLookActivity}: java.lang.SecurityException: Not allowed to bind to service
Intent { act="Base app permission" pkg=base app package }
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.os.Handler.dispatchMessage(Handler.java:99)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.os.Looper.loop(Looper.java:137)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ActivityThread.main(ActivityThread.java:5103)
04-10 10:44:42.170: E/AndroidRuntime(2316): at java.lang.reflect.Method.invokeNative(Native Method)
04-10 10:44:42.170: E/AndroidRuntime(2316): at java.lang.reflect.Method.invoke(Method.java:525)
04-10 10:44:42.170: E/AndroidRuntime(2316): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-10 10:44:42.170: E/AndroidRuntime(2316): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-10 10:44:42.170: E/AndroidRuntime(2316): at dalvik.system.NativeStart.main(Native Method)
04-10 10:44:42.170: E/AndroidRuntime(2316): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { act="Base app permission" pkg=base app package }
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1478)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ContextImpl.bindService(ContextImpl.java:1448)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.content.ContextWrapper.bindService(ContextWrapper.java:496)
04-10 10:44:42.170: E/AndroidRuntime(2316): at Mypackage.IabHelper.startSetup(IabHelper.java:269)
04-10 10:44:42.170: E/AndroidRuntime(2316): at Mypackage.IssueFirstLookActivity.onCreate(IssueFirstLookActivity.java:443)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.Activity.performCreate(Activity.java:5133)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-10 10:44:42.170: E/AndroidRuntime(2316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
04-10 10:44:42.170: E/AndroidRuntime(2316): ... 11 more