0

I have a strange problem on Android API 27 and higher. I have an app for our fire department, that checks every received SMS, and react to it, if the sender is a specified number. (We use SMS alarming, and this app must fire up on each SMS alarm and start doing stuff). Everything works perfectly for android version 26 and below. But for higher versions, the app stops reading received SMSs after a few hours. I need to go to apps permissions to manually disable and re-enable SMS permission, then it works for a few hours again!! Arrrghhh

I have a BroadcastReceiver class with onReceive function and i have it declared in the Manifest.

The permission is asked with this code:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED)) {
        requestPermissions(arrayOf(Manifest.permission.READ_SMS), REQ_SMS_READ)
    }

What am I doing wrong here?

Thanks so much for your input!

shkschneider
  • 17,833
  • 13
  • 59
  • 112
Martin
  • 9
  • 2
  • Your title is missleading as it has nothing to do with Kotlin.. – shkschneider Jan 14 '19 at 08:36
  • OK, thanks for your eddit of the title! – Martin Jan 14 '19 at 10:40
  • Please check: https://proandroiddev.com/no-more-sms-call-log-permissions-now-what-9b8226de7827 – shkschneider Jan 14 '19 at 10:55
  • Hey. I've read this allready, and I've allready submit the Google Play Permissions Declaration Form, to get the permission for my app. But If these restrictions would be the matter here, then I believe my app wouldn't work at all...? I just want the permission to be effective the whole time, and not just for a day. – Martin Jan 14 '19 at 12:16
  • Honestly I don't know. It just smells a lot like related to me, but that's it. That's why I commented and did not propose an answer. Good luck, upvoted! – shkschneider Jan 14 '19 at 13:08

0 Answers0