Add log to OsmandApiUtils
This commit is contained in:
parent
c15922d08b
commit
bc1f942166
2 changed files with 6 additions and 3 deletions
|
@ -27,6 +27,7 @@ object AndroidNetworkUtils {
|
||||||
return try {
|
return try {
|
||||||
sendRequest(urlText)
|
sendRequest(urlText)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
log.error(e.message, e)
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,8 +55,7 @@ object AndroidNetworkUtils {
|
||||||
val responseBody = StringBuilder()
|
val responseBody = StringBuilder()
|
||||||
responseBody.setLength(0)
|
responseBody.setLength(0)
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
val bufferedInput =
|
val bufferedInput = BufferedReader(InputStreamReader(inputStream, "UTF-8"))
|
||||||
BufferedReader(InputStreamReader(inputStream, "UTF-8"))
|
|
||||||
var s = bufferedInput.readLine()
|
var s = bufferedInput.readLine()
|
||||||
var first = true
|
var first = true
|
||||||
while (s != null) {
|
while (s != null) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.telegram.utils
|
package net.osmand.telegram.utils
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil
|
||||||
import net.osmand.telegram.TelegramApplication
|
import net.osmand.telegram.TelegramApplication
|
||||||
import net.osmand.telegram.TelegramSettings
|
import net.osmand.telegram.TelegramSettings
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
|
@ -7,6 +8,8 @@ import org.json.JSONObject
|
||||||
|
|
||||||
object OsmandApiUtils {
|
object OsmandApiUtils {
|
||||||
|
|
||||||
|
private val log = PlatformUtil.getLog(OsmandApiUtils::class.java)
|
||||||
|
|
||||||
fun updateSharingDevices(app: TelegramApplication, userId: Int) {
|
fun updateSharingDevices(app: TelegramApplication, userId: Int) {
|
||||||
AndroidNetworkUtils.sendRequestAsync(
|
AndroidNetworkUtils.sendRequestAsync(
|
||||||
"https://osmand.net/device/send-devices?uid=$userId",
|
"https://osmand.net/device/send-devices?uid=$userId",
|
||||||
|
@ -36,7 +39,7 @@ object OsmandApiUtils {
|
||||||
list.add(deviceBot)
|
list.add(deviceBot)
|
||||||
}
|
}
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
|
log.error(e.message, e)
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue