This commit is contained in:
Alexey Kulish 2016-09-13 18:10:19 +03:00
parent 4f3b58da9b
commit 26703154b1
3 changed files with 27 additions and 15 deletions

View file

@ -71,7 +71,8 @@ public class AndroidNetworkUtils {
} }
params = sb.toString(); params = sb.toString();
} }
connection = NetworkUtils.getHttpURLConnection(params == null || post ? url : url + "&" + params); String paramsSeparator = url.indexOf('?') == -1 ? "?" : "&";
connection = NetworkUtils.getHttpURLConnection(params == null || post ? url : url + paramsSeparator + params);
connection.setRequestProperty("Accept-Charset", "UTF-8"); connection.setRequestProperty("Accept-Charset", "UTF-8");
connection.setRequestProperty("User-Agent", Version.getFullVersion(ctx)); connection.setRequestProperty("User-Agent", Version.getFullVersion(ctx));
connection.setConnectTimeout(15000); connection.setConnectTimeout(15000);

View file

@ -11,7 +11,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import net.osmand.FloatMath;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;

View file

@ -262,19 +262,25 @@ public class IabHelper {
} }
}; };
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); try {
serviceIntent.setPackage("com.android.vending"); Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) { serviceIntent.setPackage("com.android.vending");
// service available to handle that Intent if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); // service available to handle that Intent
} mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
else { } else {
// no service available to handle that Intent // no service available to handle that Intent
mServiceConn = null; mServiceConn = null;
if (listener != null) {
listener.onIabSetupFinished(
new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
"Billing service unavailable on device."));
}
}
} catch (Exception e) {
if (listener != null) { if (listener != null) {
listener.onIabSetupFinished( listener.onIabSetupFinished(new IabResult(IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE,
new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, "InAppBillingService not available"));
"Billing service unavailable on device."));
} }
} }
} }
@ -290,7 +296,13 @@ public class IabHelper {
mSetupDone = false; mSetupDone = false;
if (mServiceConn != null) { if (mServiceConn != null) {
logDebug("Unbinding from service."); logDebug("Unbinding from service.");
if (mContext != null) mContext.unbindService(mServiceConn); try {
if (mContext != null) {
mContext.unbindService(mServiceConn);
}
} catch (Exception e) {
logError("Unbinding failed.");
}
} }
mDisposed = true; mDisposed = true;
mContext = null; mContext = null;