question

mybmr avatar image
mybmr asked mybmr edited

Why subscription ID is not changing ?

Hello greetings of the day,


I implemented below subscription code as sdk suggested. when I change subscription tire from app market getting same subscription ID every time how many times I changes different subscription.

Note :- We have 6 different subscription in app.


private void getAppObject() {
    new AsyncTask<Void, Void, App>() {

        @Override
        protected App doInBackground(Void... params) {
            try {
                if (connector != null) {
                    return connector.getApp();
                }
            } catch (RemoteException e) {
                e.printStackTrace();
            } catch (ServiceException e) {
                e.printStackTrace();
            } catch (BindingException e) {
                e.printStackTrace();
            } catch (ClientException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(App app) {
            super.onPostExecute(app);

            if (!isFinishing() && app != null) {
                appObject = app;
                appName.setText(getString(R.string.merchant_app_name, app.getName()));
                if (app.getCurrentSubscription() != null) {
                    AppSubscription subscription = app.getCurrentSubscription();
                    if (Strings.isNullOrEmpty(subscription.getDescription())) {
                        currentSubscription.setText(subscription.getName());
                    } else {
                        currentSubscription.setText(getString(R.string.colon_separated_strings, subscription.getName(), subscription.getDescription()));
                    }
                }
                if (app.getAvailableSubscriptions() != null) {
                    subscriptions.removeAllViews();
                    for (AppSubscription subscription : app.getAvailableSubscriptions()) {
                        // Only display active subscriptions
                        if (subscription.getActive()) {
                            TextView item = (TextView) getLayoutInflater().inflate(R.layout.item_text_view, null);
                            if (Strings.isNullOrEmpty(subscription.getDescription())) {
                                item.setText(subscription.getName());
                            } else {
                                item.setText(getString(R.string.colon_separated_strings, subscription.getName(), subscription.getDescription()));
                            }
                            subscriptions.addView(item);
                        }
                    }
                }

                if (app.getAvailableMetereds() != null) {
                    metereds.removeAllViews();
                    for (AppMetered metered : app.getAvailableMetereds()) {
                        // Only display active subscriptions
                        if (metered.getActive()) {
                            TextView item = (TextView) getLayoutInflater().inflate(R.layout.item_text_view, null);
                            item.setText(getString(R.string.metered_string, metered.getAmount(), metered.getAction()));
                            metereds.addView(item);
                        }
                    }
                }
            }
        }
    }.execute();
}


Can you let me know what is wrong ?

Clover Android SDK
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community