com.anjlab.android.iab.v3.BillingProcessor Java Examples

The following examples show how to use com.anjlab.android.iab.v3.BillingProcessor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DonateActivity.java    From SimplicityBrowser with MIT License 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    if(UserPreferences.getBoolean("dark_mode", false)){
        setTheme(R.style.SettingsThemeDark);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_donate);
    bp = BillingProcessor.newBillingProcessor(this, "", this);
    bp.initialize();
    mToolbar = findViewById(R.id.toolbar);
    amount = findViewById(R.id.amount);
    description = findViewById(R.id.description);
    pay = findViewById(R.id.paypal);
    seekBar = findViewById(R.id.seek);
    seekBar.setOnSeekBarChangeListener(this);
    pay.setOnClickListener(this);
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
    }
}
 
Example #2
Source File: DonationsDialog.java    From Orin with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this);

    @SuppressLint("InflateParams")
    View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null);
    ProgressBar progressBar = ButterKnife.findById(customView, R.id.progress);
    MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor());

    return new MaterialDialog.Builder(getContext())
            .title(R.string.support_development)
            .customView(customView, false)
            .build();
}
 
Example #3
Source File: BillingActivity.java    From Shipr-Community-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_billing);

    billingLogView = findViewById(R.id.billingLog);

    bp = new BillingProcessor(this, BuildConfig.billing_key, this);
    bp.initialize();


    // or bp = BillingProcessor.newBillingProcessor(this, "YOUR LICENSE KEY FROM GOOGLE PLAY CONSOLE HERE", this);
    // See below on why this is a useful alternative
}
 
Example #4
Source File: DonateActivity.java    From GPS2SMS with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ShowBackButton();

    setContentView(R.layout.activity_donate);

    bp = new BillingProcessor(DonateActivity.this, LICENSE_KEY, new BillingProcessor.IBillingHandler() {
        @Override
        public void onProductPurchased(String productId, TransactionDetails details) {
            //DBHelper.ShowToastT(DonateActivity.this, "onProductPurchased: " + productId, Toast.LENGTH_LONG);
            refreshPurchasesStatus();
        }

        @Override
        public void onBillingError(int errorCode, Throwable error) {
            // DBHelper.ShowToastT(DonateActivity.this, "onBillingError: " + Integer.toString(errorCode), Toast.LENGTH_LONG);
            refreshPurchasesStatus();
        }

        @Override
        public void onBillingInitialized() {
            readyToPurchase = true;
            DonatePriceTextLoadAsyncTask mt = new DonatePriceTextLoadAsyncTask();
            mt.execute();
        }

        @Override
        public void onPurchaseHistoryRestored() {
            //DBHelper.ShowToastT(DonateActivity.this, "onPurchaseHistoryRestored", Toast.LENGTH_LONG);
            refreshPurchasesStatus();
        }
    });

    // ListView on Fragments
    DonateListFragment fragment = new DonateListFragment();
    getSupportFragmentManager().beginTransaction().replace(R.id.frgmCont, fragment).commit();

}
 
Example #5
Source File: App.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Void doInBackground(Void... params) {
    BillingProcessor billingProcessor = billingProcessorWeakReference.get();
    if (billingProcessor != null) {
        // The Google billing library has it's own cache for about 8 - 12 hours.
        // The following only updates the billing processors cache if the Google billing library returns a value.
        // Therefore, even if the user is longer than 8 - 12 hours without internet the purchase is cached.
        billingProcessor.loadOwnedPurchasesFromGoogle();
    }
    return null;
}
 
Example #6
Source File: DonationsDialog.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this);

    @SuppressLint("InflateParams")
    View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null);
    ProgressBar progressBar = customView.findViewById(R.id.progress);
    MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor());

    return new MaterialDialog.Builder(getContext())
            .title(R.string.support_development)
            .customView(customView, false)
            .build();
}
 
Example #7
Source File: InAppBillingProcessor.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
public BillingProcessor getProcessor() {
    if (mLicenseKey == null) {
        LogUtil.e("InAppBillingProcessor: license key is null, make sure to call InAppBillingProcessor.init() first");
    }

    if (mInAppBilling.get().mBillingProcessor == null || !mInAppBilling.get().mIsInitialized) {
        mInAppBilling.get().mBillingProcessor = new BillingProcessor(
                mInAppBilling.get().mContext,
                mLicenseKey,
                mInAppBilling.get());
    }
    return mInAppBilling.get().mBillingProcessor;
}
 
Example #8
Source File: InAppBillingProcessor.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
public BillingProcessor getProcessor() {
    if (mLicenseKey == null) {
        LogUtil.e("InAppBillingProcessor: license key is null, make sure to call InAppBillingProcessor.init() first");
    }

    if (mInAppBilling.get().mBillingProcessor == null || !mInAppBilling.get().mIsInitialized) {
        mInAppBilling.get().mBillingProcessor = new BillingProcessor(
                mInAppBilling.get().mContext,
                mLicenseKey,
                mInAppBilling.get());
    }
    return mInAppBilling.get().mBillingProcessor;
}
 
Example #9
Source File: InAppBillingProcessor.java    From candybar with Apache License 2.0 5 votes vote down vote up
public BillingProcessor getProcessor() {
    if (mLicenseKey == null) {
        LogUtil.e("InAppBillingProcessor: license key is null, make sure to call InAppBillingProcessor.init() first");
    }

    if (mInAppBilling.get().mBillingProcessor == null || !mInAppBilling.get().mIsInitialized) {
        mInAppBilling.get().mBillingProcessor = new BillingProcessor(
                mInAppBilling.get().mContext,
                mLicenseKey,
                mInAppBilling.get());
    }
    return mInAppBilling.get().mBillingProcessor;
}
 
Example #10
Source File: BuyActivity.java    From Telephoto with Apache License 2.0 4 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    bp = new BillingProcessor(this, PUBLIC_KEY, this);
}
 
Example #11
Source File: InAppPurchaseHelper.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public InAppPurchaseHelper(AppCompatActivity activity) {
    mActivity = activity;
    mBillingProcessor = new BillingProcessor(activity, Premium.BASE64_KEY, this);
}
 
Example #12
Source File: MainActivity.java    From TwistyTimer with GNU General Public License v3.0 4 votes vote down vote up
public BillingProcessor getBp () {
    return bp;
}
 
Example #13
Source File: MainActivity.java    From TwistyTimer with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (DEBUG_ME) Log.d(TAG, "updateLocale(savedInstanceState="
            + savedInstanceState + "): " + this);

    setTheme(ThemeUtils.getPreferredTheme());

    // Set text styling
    if (!Prefs.getString(R.string.pk_text_style, "default").equals("default")) {
        getTheme().applyStyle(ThemeUtils.getPreferredTextStyle(), true);
    }

    // Set navigation bar tint
    if (Prefs.getBoolean(R.string.pk_tint_navigation_bar, false)) {
        getTheme().applyStyle(R.style.TintedNavigationBar, true);
        // Set navigation bar icon tint
        if (ThemeUtils.fetchAttrBool(this, ThemeUtils.getPreferredTheme(), R.styleable.BaseTwistyTheme_isLightTheme)) {
            getTheme().applyStyle(R.style.LightNavBarIconStyle, true);
        }
    }



    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    bp = new BillingProcessor(this, null, this);

    fragmentManager = getSupportFragmentManager();

    if (savedInstanceState == null) {
        fragmentManager
            .beginTransaction()
            .replace(R.id.main_activity_container, TimerFragmentMain.newInstance(PuzzleUtils.TYPE_333, "Normal", TimerFragment.TIMER_MODE_TIMER, TrainerScrambler.TrainerSubset.OLL), "fragment_main")
            .commit();
    }

    handleDrawer(savedInstanceState);
}
 
Example #14
Source File: BillingActivity.java    From IslamicLibraryAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    ((IslamicLibraryApplication) getApplication()).refreshLocale(this, false);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_billing);
    ButterKnife.bind(this);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setTitle(R.string.financial_aid);
    }

    if (!BillingProcessor.isIabServiceAvailable(this)) {
        showToast(R.string.iap_not_available);
    }

    bp = new BillingProcessor(this, LICENSE_KEY, new BillingProcessor.IBillingHandler() {
        @Override
        public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) {
            billingItemsRecyclerViewAdapter.notifyProductPurchased(productId, details);
        }

        @Override
        public void onBillingError(int errorCode, @Nullable Throwable error) {
            Timber.e(error);
            // showToast("onBillingError: " + Integer.toString(errorCode));
        }

        @Override
        public void onBillingInitialized() {
            readyToPurchase = true;
            billingItemsRecyclerViewAdapter.setReadyToPurchase(true);
            billingItemsRecyclerViewAdapter.notifyDataSetChanged();
        }

        @Override
        public void onPurchaseHistoryRestored() {
            billingItemsRecyclerViewAdapter.notifyDataSetChanged();
        }
    });
    billingItemsRecyclerViewAdapter = new BillingItemsRecyclerViewAdapter(this);
    recyrecyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyrecyclerView.setHasFixedSize(true);
    recyrecyclerView.setAdapter(billingItemsRecyclerViewAdapter);
    mIsArabic = Util.isArabicUi(this);

}
 
Example #15
Source File: InAppBillingBridge.java    From react-native-billing with MIT License 4 votes vote down vote up
private Boolean isIabServiceAvailable() {
    return BillingProcessor.isIabServiceAvailable(_reactContext);
}
 
Example #16
Source File: BillingService.java    From fingen with Apache License 2.0 4 votes vote down vote up
public boolean isBillingAvailable() {
    return BillingProcessor.isIabServiceAvailable(FGApplication.getAppComponent().getContext());
}
 
Example #17
Source File: BillingService.java    From fingen with Apache License 2.0 4 votes vote down vote up
public BillingProcessor getBillingProcessor() {
    return mBillingProcessor;
}
 
Example #18
Source File: App.java    From Phonograph with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    app = this;

    // default theme
    if (!ThemeStore.isConfigured(this, 1)) {
        ThemeStore.editTheme(this)
                .primaryColorRes(R.color.md_indigo_500)
                .accentColorRes(R.color.md_pink_A400)
                .commit();
    }

    // Set up dynamic shortcuts
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).initDynamicShortcuts();
    }

    // automatically restores purchases
    billingProcessor = new BillingProcessor(this, App.GOOGLE_PLAY_LICENSE_KEY, new BillingProcessor.IBillingHandler() {
        @Override
        public void onProductPurchased(@NonNull String productId, TransactionDetails details) {
        }

        @Override
        public void onPurchaseHistoryRestored() {
            if (App.isProVersion()) {
                App.notifyProVersionChanged();
            }
        }

        @Override
        public void onBillingError(int errorCode, Throwable error) {
        }

        @Override
        public void onBillingInitialized() {
            App.loadPurchases(); // runs in background
        }
    });
}
 
Example #19
Source File: App.java    From Phonograph with GNU General Public License v3.0 4 votes vote down vote up
LoadOwnedPurchasesFromGoogleAsyncTask(BillingProcessor billingProcessor) {
    this.billingProcessorWeakReference = new WeakReference<>(billingProcessor);
}
 
Example #20
Source File: BillingService.java    From fingen with Apache License 2.0 4 votes vote down vote up
public BillingService() {
    FGApplication.getAppComponent().inject(this);
    mBillingProcessor = new BillingProcessor(FGApplication.getContext(), getDeveloperKey(), null, new BillingHandler());
}