I'm creating an app that needs to send an automatic SMS on the users phone. I've tested with many phones with versions under 7.0 and they all worked. I've also tested on the emulators (7.0) and it worked fine but when I tested with two (real) 7.0 android phones it crashed. Can someone help?
Thanks in advance.
Code that I'm using to send message:
String message1 = "Oi! Eu saí de " + localizacaoFrom + " e fui até " + localizacaoTo + " hoje, mas se você recebeu essa mensagem, significa que talvez algo tenha ocorrido comigo. Você poderia me ligar? (Eu utilizei o app SempreSeguro para enviar esta mensagem)";
SmsManager smsManager = SmsManager.getDefault();
ArrayList<String> parts = smsManager.divideMessage(message1);
smsManager.sendMultipartTextMessage(FirstNumber, null, parts, null, null);
My build.grade (just in case):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.xxx.xxxxxxx"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
}