我一直在开发一个应用程序来回复收到的 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/