【发布时间】:2012-02-19 06:55:33
【问题描述】:
我正在开发一个不会将消息保存在收件箱中的 android SMS 应用程序。 我需要使用网络服务调用验证消息的内容,然后删除广播。
在 SMSReceiver 的 onReceive() 中
if (messageBody.equals("somedata"))
{
Intent i = new Intent(context,Webservice.class);//webservice validation
i.putExtra("messageBody",messageBody)
startService(i);
// Stop it being passed to the main Messaging inbox
abortBroadcast();
}
用于 web 服务调用的 Intentservice 永远不会被执行。接收器在此之前被中止。 我是android新手,所以请让我知道在广播接收器(SMS_RECEIVE)的onReceive()中启动的意图服务中进行网络服务调用是否正确。
【问题讨论】:
-
您是否在您的 androidmainfest.xml 文件中授予了读取权限?
-
是的,我已授予以下权限