4

I am developing an android application which will send MMS. But to send mms in need to read APN settings of user. I searched on internet. But the solution i get is by using Content Provider with uri of

"content://telephony/carriers/preferapn".

But when ever i call it using

Cursor c = this.getContentResolver().query("content://telephony/carriers/preferapn",null,null,null,null);

It is throwing exception of "No permission to write APN settings". But i only want to read. Not write. Please tell me how to read apn settings. Only read, Not write. I am developing application which will support SDK 15 and above.

Ali Abbas
  • 41
  • 4
  • You might have a look at [this answer](http://stackoverflow.com/a/18897139). I could only get it working by using reflection, however. – Mike M. Dec 02 '15 at 09:27
  • It is throwing security exception. – Ali Abbas Dec 03 '15 at 09:38
  • I guess there's really two different answers there. Which one did you try? I meant the one using the `android.database.sqlite.SqliteWrapper` class, under "And for Android 4.2 and more use this code :". I believe for lower versions, the first answer works, so it'll depend on which version your code is running under as to which method you should use. – Mike M. Dec 03 '15 at 09:50

0 Answers0