onepf / OpenIAB

Open In-App Billing for Google Play, SlideMe, Amazon Store, Nokia Store, Samsung Apps, Yandex.Store, Appland, Aptoide, AppMall and Fortumo.
http://onepf.org/openiab/
Apache License 2.0
474 stars 171 forks source link

Samsung Apps ActivityNotFound #147

Closed kwadkore closed 9 years ago

kwadkore commented 10 years ago

I looked through the code and it does exactly what the Samsung tutorial says so I'm not sure why this error would come up. In my version of OpenIAB, SamsungApps is chosen as the installer if the installer package name is com.sec.android.app.samsungapps, so maybe they're behind on updating the docs.

Raw stacktrace: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.sec.android.iap/com.sec.android.iap.activity.AccountActivity}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1388) at android.app.Activity.startActivityForResult(Activity.java:3195) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) at org.onepf.oms.appstore.SamsungAppsBillingService.startSetup(SamsungAppsBillingService.java:163) at org.onepf.oms.OpenIabHelper$1.run(OpenIabHelper.java:326)

oorlov commented 10 years ago

I guess it's because we dropped following part of recommendations from Samsung's doc: Samsung IAP service is not part of SamsungApps and not installed by default. So need to perform such code before setup OpenIAB

        try {
            PackageManager pm = this.getPackageManager();
            try {
                pm.getApplicationInfo("com.sec.android.iap", PackageManager.GET_META_DATA);
            } catch (NameNotFoundException e) {
                Intent intent = new Intent();
                intent.setData(Uri.parse("samsungapps://ProductDetail/com.sec.android.iap"));
                if (Build.VERSION.SDK_INT >= 12) {
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | 32);
                } else {
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                }
                startActivity(intent);
                this.finish();
                e.printStackTrace();
            }
        } catch (Exception e1) {
            e1.printStackTrace();
        }

It looks like we need to return such code back to OpenIAB

kwadkore commented 10 years ago

Where is this code supposed to go?

oorlov commented 10 years ago

Before helper.startSetup()

akarimova commented 9 years ago

Outdated.