Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions f...
If you think the Android project Dual-Battery-Widget listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2011 Artiom Chilaru (http://flexlabs.org)
*//www.java2s.com
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package org.flexlabs.widgets.dualbattery;
import android.app.Application;
import android.app.PendingIntent;
import android.content.pm.PackageManager;
import net.robotmedia.billing.BillingController;
import net.robotmedia.billing.BillingRequest;
import net.robotmedia.billing.IBillingObserver;
import net.robotmedia.billing.model.Transaction;
publicclass BatteryApplication extends Application {
privatestatic BatteryApplication _instance;
publicstatic BatteryApplication getInstance() { return _instance; }
@Override
publicvoid onCreate() {
super.onCreate();
_instance = this;
try {
String pkg = getPackageName();
Constants.VERSION = getPackageManager().getPackageInfo(pkg, 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
Constants.VERSION = "?";
}
BillingController.setDebug(Constants.DEBUG);
BillingController.setConfiguration(new BillingController.IConfiguration() {
@Override
publicbyte[] getObfuscationSalt() {
returnnewbyte[] {41, -90, -116, -41, 77, -53, 127, -110, -127, -96, -88, 77, 127, 117, 1, 73, 57, 110, 48, -116};
}
@Override
public String getPublicKey() {
return"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmRLx8FRLePsmwi0uXID5uUzf6oWe8KFmUtLaApbiNIG+qDrPAVScKjE1KEdNWBAlzyc70Ohihh73e7/BBuzLECZFjZo7Xbks6JdZ2zxii8OCclDdYq5MZQkkuLUCrNd2B97+JwKaYjdDdjkIVcUP0jWyGWEXnFo6pjZK0VRLEFITDbt4vq/NfJpxWrnI8j95GWJUTlZ26TdY/1tjUaXr6l3GuWj71RlvRQuCPnjneLwZjdLjxYfZknGRhHTCXlIVfdGhcbuaOem1IL+R5xFbJftAXJfM2kgoNIb/FhbNLWjM1jdjemWaWyhhcz3AhEk92Fbc5ZLxhsh4oYcVB0uLRwIDAQAB";
}
});
BillingController.registerObserver(new IBillingObserver() {
@Override
publicvoid onBillingChecked(boolean supported) {
Constants.HAS_GPLAY_BILLING = supported;
BillingController.unregisterObserver(this);
}
@Override publicvoid onPurchaseIntent(String itemId, PendingIntent purchaseIntent) { }
@Override publicvoid onPurchaseStateChanged(String itemId, Transaction.PurchaseState state) { }
@Override publicvoid onRequestPurchaseResponse(String itemId, BillingRequest.ResponseCode response) { }
@Override publicvoid onTransactionsRestored() { }
});
BillingController.checkBillingSupported(this);
}
}