简体   繁体   中英

Not able to send SMS even through the emulator and a real phone

I have written code to send a sms at a click of a Button which isn't doing it, and the error is:

Sending SMS message: user 10037 doesnot have android.permission.SEND_SMS

Can anybody help me? I don't know where the problem is. My code is as:

在此处输入图片说明

在此处输入图片说明

and the XML is as:

在此处输入图片说明

I have even included the user permission in manifest file as SEND_SMS.

My Manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.volienceagainstwomen.vaw"
android:versionCode="1"

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

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="19" />   

<application
    android:allowBackup="true"
    android:screenOrientation="portrait"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.volienceagainstwomen.vaw.MainActivity_VAW"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>
    <activity
        android:name="com.volienceagainstwomen.vaw.MainActivity_Settings"
        android:label="@string/title_activity_main_activity__settings" >
    </activity>
    <activity
        android:name="com.volienceagainstwomen.vaw.SettingsActivity"
        android:label="@string/title_activity_settings" >

    </activity>
</application>

</manifest>

and the logcat is as:

03-25 17:24:10.917: E/InputEventReceiver(698): Exception dispatching input event.
03-25 17:24:10.986: E/MessageQueue-JNI(698): Exception in MessageQueue callback: handleReceiveCallback
03-25 17:24:11.626: E/MessageQueue-JNI(698): java.lang.SecurityException: Sending SMS message: User 10044 does not have android.permission.SEND_SMS.
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.os.Parcel.readException(Parcel.java:1425)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.os.Parcel.readException(Parcel.java:1379)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at com.volienceagainstwomen.vaw.MainActivity_VAW.sendSms(MainActivity_VAW.java:114)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at com.volienceagainstwomen.vaw.MainActivity_VAW$2.onTouch(MainActivity_VAW.java:98)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.View.dispatchTouchEvent(View.java:7122)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877)
03-25 17:24:11.626: E/MessageQueue-JNI(698):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)

An emulator can't call nor send SMS, since it doesn't have a SIM Card, which is needed to place calls or send SMS.

These are services which have a cost which is then charged to your SIM.
You can't have these services FOR FREE!

It would be beautiful, if we could send SMS or MMS via the emulator...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM