-3

I am trying to send SMS from within a service but the following error is thrown. The service Java file has been attached with the error code. Need assistance for the service as the service is not able o send the SMS.

I want to know if there is some way in which i can give permission to the service for sending the SMS or in any way i can complete the same.

 Sending SMS message: uid 10235 does not have android.permission.SEND_SMS.

My Code is as follows :-

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(num1, null, sms_message+"", null, null);
smsManager.sendTextMessage(num2, null, sms_message+"", null, null);
smsManager.sendTextMessage(num3, null, sms_message+"", null, null);

My Manifest File is show below

<uses-permission android:name="android.permission.SEND_SMS" />
Cyborg
  • 357
  • 5
  • 12

2 Answers2

4

First make sure you have added uses-permission in the AndroidManifest.xml Second if you target android 6.0 and above, make sure to have a look at Runtime Permission

LdBach
  • 56
  • 5
1

You have not set the android.permission.SEND_SMS in your AndroidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.snazzyapp">

    <uses-permission android:name="android.permission.SEND_SMS"/>


    <application ...>
        ...
    </application>

</manifest>
pleft
  • 7,567
  • 2
  • 21
  • 45