-1

Even I am granting run time permission for read sms, I am not able to received broadcast for incoming sms and Cursor return by Content Provider is also returning 0 data every time while reading sms inbox.

Any idea why?

Floern
  • 33,559
  • 24
  • 104
  • 119
Keyur Thumar
  • 608
  • 7
  • 19

2 Answers2

0

Check whether your application has the permission to read sms in your phone.

It may happen that targeted sdk version is less than 23 and you are only providing permission in the manifest and not programmatically checking for the permission explicitly.

Shreyansh Patni
  • 401
  • 2
  • 17
0

Try to change the priority of the filter 100 in the manifest file. Why use ContentProvider for Broadcast messages if the method onRecieve possible to get the message? Also, check method the onRecieve, this method should be performed as quickly as possible. You can connect the service for time-consuming operations. If you granted RECEIVE_SMS, but not the READ_SMS then ContentProvider should not work.

loki
  • 9,816
  • 7
  • 56
  • 82
Yanbaev
  • 1
  • 3
  • Also try add android:permission="android.permission.RECEIVE_SMS" in declaration receiver's in manifest file – Yanbaev Sep 28 '16 at 09:06
  • i have tried same but its not working in version M. Hey man don't be sorry for what you don't be. Thanks for answer. – Keyur Thumar Sep 28 '16 at 09:59
  • Give block declaration of receiver and permission in manifest and code of the receiver, please – Yanbaev Sep 28 '16 at 11:03