Fix Toasts from Background Thread

This commit is contained in:
shabinder 2021-09-26 13:52:46 +05:30
parent 9add1dd88c
commit c4adc1a0db
2 changed files with 8 additions and 6 deletions

View File

@ -243,11 +243,13 @@ class MainActivity : ComponentActivity() {
} }
private fun showPopUpMessage(string: String, long: Boolean = false) { private fun showPopUpMessage(string: String, long: Boolean = false) {
android.widget.Toast.makeText( runOnUiThread {
applicationContext, android.widget.Toast.makeText(
string, applicationContext,
if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT string,
).show() if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT
).show()
}
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")

View File

@ -25,7 +25,7 @@ internal class DesktopAnalyticsManager(
loggingLevel = LoggingLevel.ERROR loggingLevel = LoggingLevel.ERROR
setDeviceIdStrategy(DeviceIdStrategy.UUID) setDeviceIdStrategy(DeviceIdStrategy.UUID)
enableFeatures(*featuresSet) enableFeatures(*featuresSet)
setRequiresConsent(true) setRequiresConsent(false)
} }
Countly.init(File(fileManager.defaultDir()), config) Countly.init(File(fileManager.defaultDir()), config)