21 |
import android.widget.Button; |
import android.widget.Button; |
22 |
import android.widget.Toast; |
import android.widget.Toast; |
23 |
|
|
|
import com.example.android.trivialdrivesample.util.IabHelper; |
|
|
import com.example.android.trivialdrivesample.util.IabResult; |
|
24 |
import com.nullwire.trace.ExceptionHandler; |
import com.nullwire.trace.ExceptionHandler; |
25 |
|
|
26 |
import dk.thoerup.androidutils.CheckUpdates; |
import dk.thoerup.androidutils.CheckUpdates; |
42 |
ListFavorites |
ListFavorites |
43 |
} |
} |
44 |
|
|
|
IabHelper mHelper; |
|
45 |
|
|
46 |
Handler handler = new Handler(); |
Handler handler = new Handler(); |
47 |
|
|
126 |
} |
} |
127 |
|
|
128 |
|
|
|
try { |
|
|
initBilling(); |
|
|
} catch (Exception e) { |
|
|
//Do nothing - just don't crash if billing failed to initialize |
|
|
} |
|
|
|
|
|
|
|
129 |
} |
} |
130 |
|
|
|
private void initBilling() { |
|
|
String base64EncodedPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAln3XRJzM8Eo/SSMBLzSOj9pLedftZrWONRLO9KC/BU1Bv0EK3PQhza1S6apS69fa300ZitKSB91WDkf88eW4VJq8txmq8W1J2x/WJCFRQnFaPP0pDgERo9EdEULH2ybsOape/7+ypqNaDWxuqBh4fQfAd+Qpgdz8E7y5ZNbIKqJnRn2gyEfpzytiNQKNATI+XxJfyrS7urg/u/hXYw1R7VBNoAO7KU3b4D205WtXBn2u+Zexjd5disVGmZ5jd0BiuVOyPIWK5e9tA/VnKl/6XDfB9utCtXcAWFVUoVE6+8HWwo9ugFauuwYmbl6pTZydPKjyh9WxVR5MS2TPue/wEwIDAQAB"; |
|
|
|
|
|
// compute your public key and store it in base64EncodedPublicKey |
|
|
mHelper = new IabHelper(this, base64EncodedPublicKey); |
|
|
mHelper.enableDebugLogging(true); |
|
|
|
|
|
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { |
|
|
public void onIabSetupFinished(IabResult result) { |
|
|
|
|
|
Log.d("TrainInfo", "onIabSetupFinished"); |
|
|
|
|
|
if (!result.isSuccess()) { |
|
|
// Oh noes, there was a problem. |
|
|
Log.d("TrainInfo", "Problem setting up In-app Billing: " + result); |
|
|
} |
|
|
// Hooray, IAB is fully set up! |
|
|
} |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
131 |
|
|
132 |
|
|
133 |
@Override |
@Override |
136 |
if (stationLoader != null) { |
if (stationLoader != null) { |
137 |
stationLoader.cancel(true); |
stationLoader.cancel(true); |
138 |
stationLoader = null; |
stationLoader = null; |
139 |
} |
} |
|
if (mHelper != null) { |
|
|
try { |
|
|
mHelper.dispose(); |
|
|
} catch (Exception e) { |
|
|
//Do Nothing |
|
|
} |
|
|
mHelper = null; |
|
|
} |
|
|
|
|
140 |
|
|
141 |
ProviderFactory.purgeOldEntries(); //exiting application, do some cleanup |
ProviderFactory.purgeOldEntries(); //exiting application, do some cleanup |
142 |
} |
} |