This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isCafeInstalled() { | |
PackageManager pm = getPackageManager(); | |
try { | |
pm.getPackageInfo("com.farsitel.bazaar", 0); | |
return true; | |
} catch (PackageManager.NameNotFoundException e) { | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
mHelper.handleActivityResult(requestCode, resultCode, data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String base64EncodedPublicKey = "MIHNMA0……………...wEAAQ=="; | |
mHelper = new IabHelper(this, base64EncodedPublicKey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" ;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()) |