Android 应用程序不响应短信接收器

标签 android sms broadcastreceiver

我一直在开发一个应用程序来回复收到的 SMS 消息(在你提示之前,我知道这个问题已经被问了很多,但相信我,我根本无法让它工作,而且我已经试过了搜索小时)。我的 list 设置如下:

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

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

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".NotiScreenActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver android:name="NotiScreenSmsReceiver" android:process=":remote">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
            </intent-filter>
        </receiver>
    </application>

</manifest>

我的接收器类如下所示:

package com.csbctech.notiscreen;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.PowerManager;
import android.util.Log;

public class NotiScreenSmsReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        Log.w("NotiScreen", "Got SMS");

    }


}

但是“NotiScreenSmsReceiver”类永远不会被调用。我已经尝试了几个不同的例子,但我终其一生都无法调用接收者类......我什至尝试过删除使用权限,但我什至没有收到关于没有权限。有什么问题吗?哦,请帮助我,你是我唯一的希望!

最佳答案

您是否在装有自定义短信应用程序(例如 GOSMS)的手机上运行此程序?我听说其中一些节目会停止广播,以便他们可以创建自己的通知并停止库存通知。

关于Android 应用程序不响应短信接收器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8990642/

相关文章:

android - 使用保留的 fragment 会导致错误膨胀 SupportMapFragment?

android - 无法从应用程序类向 Android 服务广播 Intent

java - BroadcastReceiver onReceive 方法内的异步任务未运行?

android - 以编程方式发送短信而不在消息应用程序中显示

Android 中止 BroadcastReceiver

java - 需要通过行检测来检测 RecyclerView 上的点击和触摸事件

android drawable to bitmap引起的OOM

android - 在适当的外部 map 应用程序中打开 KML/GPX 文件

mobile - 程序化短信

c# - 如何加入收到的多部分短信(GSM 调制解调器)(C#)