Reputation: 466
I know there are a lot of questions about this exception but no answer suited my case.
var count = sharedPref.getInt("flutter.badgeCount", 0) // line 12
ShortcutBadger.applyCount(applicationContext, count+1) // line 13
count
should be an integer because sharedPref.getInt
returns an integer, and applyCount()
receive an integer as the second parameter. The exception is thrown at runtime at line 12.
Is there anything I can't see? (I'm pretty new to kotlin)
Upvotes: 0
Views: 4610
Reputation: 1551
Use the following. This would solve the problem.
var count = sharedPref.getLong("flutter.badgeCount", 0L)
ShortcutBadger.applyCount(applicationContext, count.toInt()+1)
Upvotes: 2