短信权限不工作。无论身在何处,我把许可标签 [英] Sms Permissions not working. No matter where I put the permission tag

查看:327
本文介绍了短信权限不工作。无论身在何处,我把许可标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想以一个简单的文本发送到我的自我。当然的例外是 java.lang.SecurityException异常:发送短信:UID 10263没有android.permission.SEND_SMS

I'm just trying to send a simple text to my self.. of course the exception is java.lang.SecurityException: Sending SMS message: uid 10263 does not have android.permission.SEND_SMS

这是我的清单文件看起来像

This is what my Manifest file looks like

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.homesafe"
    android:versionCode="1"
    android:versionName="1.0" 
    android:permission="android.permission.SEND_SMS">

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"

        >
        <activity
            android:name="com.example.homesafe.MainActivity"
            android:label="@string/app_name"

             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

现在它是清单标记下..但即使我移动应用程序下的许可标签,我仍然得到同样的错误。我很困惑。

Right now it is under the Manifest tag.. but even if I move the permission under the application tag, I still get the same error. I'm confused..

推荐答案

所有你需要做的是这样的:

All you need to do is this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.homesafe"
    android:versionCode="1"
    android:versionName="1.0">

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"

        >
        <activity
            android:name="com.example.homesafe.MainActivity"
            android:label="@string/app_name"

             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

这篇关于短信权限不工作。无论身在何处,我把许可标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆