Hola estoy tratando de enviar mensajes de texto desde mi app y usando un dispositivo físico con Android 6.0 (Moto G 3rd generation), este es el código que uso:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("12345678" , null,"hello world" , null, null);
Pero a la hora de ejecutarlo me lanza esta excepción:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.globalsiag.sms_global, PID: 22364
java.lang.SecurityException: Sending SMS message: uid 10113 does not have android.permission.SEND_SMS.
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:813)
at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:310)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:293)
at com.globalsiag.sms_global.MyGcmListenerService.onMessageReceived(MyGcmListenerService.java:88)
at com.google.android.gms.gcm.GcmListenerService.zzq(Unknown Source)
at com.google.android.gms.gcm.GcmListenerService.zzp(Unknown Source)
at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Por qué no funcionan los permisos?, debo solicitarlos por ser Android 6.0?