Skip to content

Instantly share code, notes, and snippets.

private void isUserBuyFullVersion() {
if (!isCafeInstalled()) {
Toast.makeText(this, R.string.cafebazaar_isnot_installed_error, Toast.LENGTH_SHORT).show();
return;
}
mHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (result.isFailure()) {
Toast.makeText(DetailActivity.this, R.string.query_inventory_error, Toast.LENGTH_SHORT).show();
private boolean isCafeInstalled() {
PackageManager pm = getPackageManager();
try {
pm.getPackageInfo("com.farsitel.bazaar", 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mHelper.handleActivityResult(requestCode, resultCode, data);
}
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
Toast.makeText(DetailActivity.this, R.string.setting_up_inapp_error, Toast.LENGTH_SHORT).show();
}
}
});
private void buyStreaming() {
mHelper.launchPurchaseFlow(this, SKU_STREAMING, 1, new IabHelper.OnIabPurchaseFinishedListener() {
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
if (result.isFailure()) {
Toast.makeText(DetailActivity.this, R.string.purchasing_error, Toast.LENGTH_SHORT).show();
return;
} else if (info.getSku().equals(SKU_STREAMING)) {
openPlayer();
}
String base64EncodedPublicKey = "MIHNMA0……………...wEAAQ==";
mHelper = new IabHelper(this, base64EncodedPublicKey);
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@abbas-oveissi
abbas-oveissi / AndroidManifest.xml
Last active November 26, 2019 08:18
CafeBazaar In App Purchase
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="ir.oveissi.inapppurchase">
<uses-permission android:name="com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
#!/bin/bash
#hi
echo [UBUNTU PASSWORD] | sudo -S ls
INPUT_NUMBER=$1
SERVER_URL=""
case $INPUT_NUMBER in
1) SERVER_URL="us2.cisadd3.com:800" ;;
2) SERVER_URL="de.cisadd3.com:800" ;;
3) SERVER_URL="uk.cisadd2.com" ;;
4) SERVER_URL="nl.cisadd2.com" ;;
// rxjava-challenge-solution
// this example use RxJava 1.0
// Province class => data class Province(val id: Int ,val name:String, var cities:List<City>? = null)
class DataManager {
// solution
fun getProvincesAndCities(): Observable<List<Province>> {
return getProvinces()
.subscribeOn(Schedulers.io())