Suppress reporting incompatible mode error

This commit is contained in:
Mygod
2018-06-11 20:37:22 +08:00
parent 6b24697f12
commit 9a159a9fa2

View File

@@ -90,7 +90,8 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
else -> getString(R.string.failure_reason_unknown, reason) else -> getString(R.string.failure_reason_unknown, reason)
}) })
Toast.makeText(this@LocalOnlyHotspotService, message, Toast.LENGTH_SHORT).show() Toast.makeText(this@LocalOnlyHotspotService, message, Toast.LENGTH_SHORT).show()
startFailure(StartFailure(message)) startFailure(if (reason == WifiManager.LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE) null else
StartFailure(message))
} }
}, app.handler) }, app.handler)
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
@@ -104,7 +105,7 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
return START_STICKY return START_STICKY
} }
private fun startFailure(e: Exception) { private fun startFailure(e: Exception?) {
Crashlytics.logException(e) Crashlytics.logException(e)
updateNotification() updateNotification()
ServiceNotification.stopForeground(this@LocalOnlyHotspotService) ServiceNotification.stopForeground(this@LocalOnlyHotspotService)