Add log to OsmandApiUtils

This commit is contained in:
Chumva 2018-10-03 13:14:55 +03:00
parent c15922d08b
commit bc1f942166
2 changed files with 6 additions and 3 deletions

View file

@ -27,6 +27,7 @@ object AndroidNetworkUtils {
return try {
sendRequest(urlText)
} catch (e: Exception) {
log.error(e.message, e)
null
}
}
@ -54,8 +55,7 @@ object AndroidNetworkUtils {
val responseBody = StringBuilder()
responseBody.setLength(0)
if (inputStream != null) {
val bufferedInput =
BufferedReader(InputStreamReader(inputStream, "UTF-8"))
val bufferedInput = BufferedReader(InputStreamReader(inputStream, "UTF-8"))
var s = bufferedInput.readLine()
var first = true
while (s != null) {

View file

@ -1,5 +1,6 @@
package net.osmand.telegram.utils
import net.osmand.PlatformUtil
import net.osmand.telegram.TelegramApplication
import net.osmand.telegram.TelegramSettings
import org.json.JSONException
@ -7,6 +8,8 @@ import org.json.JSONObject
object OsmandApiUtils {
private val log = PlatformUtil.getLog(OsmandApiUtils::class.java)
fun updateSharingDevices(app: TelegramApplication, userId: Int) {
AndroidNetworkUtils.sendRequestAsync(
"https://osmand.net/device/send-devices?uid=$userId",
@ -36,7 +39,7 @@ object OsmandApiUtils {
list.add(deviceBot)
}
} catch (e: JSONException) {
log.error(e.message, e)
}
return list
}