Androidプログラミング質問スレ Part18
■ このスレッドは過去ログ倉庫に格納されています
0089デフォルトの名無しさん
2012/02/08(水) 15:04:12.07どうなってんだ!!おい!w40件くらい参考にしたのに動かん
ちゃんと動作確認した上でアップされてるんだろうな・・・
[AndroidManifest.xml]
<user-permission android:name="android.permission.SEND_SMS"></user-permission>
[エラーコード箇所]
String Tel = "08012345678";
String Mes = "abc";
PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), MyActivity.class), 0);
SmsManager sms = SmsManager.getDefault();
try{
sms.sendTextMessage(Tel, null, Mes, pi, null);
} catch (IllegalArgumentException e) {
Toast.makeText(getApplicationContext(), "err[Argument]", Toast.LENGTH_SHORT).show();
} catch (SecurityException e) {
Toast.makeText(getApplicationContext(), "err[Security] : " + e, Toast.LENGTH_SHORT).show();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(), "err[State]", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "err[IO]", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "err[Ex]", Toast.LENGTH_SHORT).show();
}
[エラー内容]
「SecurityException」でcatchされる。
java.lang.SecurityException: Sending SMS message: User 10117 does not have android.permission.SEND_SMS.
■ このスレッドは過去ログ倉庫に格納されています