接收短信Android应用程序没有至少一次打开应用程序 [英] Receive SMS to Android app without opening the app at least once

查看:219
本文介绍了接收短信Android应用程序没有至少一次打开应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的Andr​​oid应用程序接收短信。我有以下我的清单中指定的接收器。

 <接收机器人:出口=真正的机器人:名字=com.lahiruchandima.myapp.SMSReceiver>
    &所述;意图滤光器>
        <作用机器人:名字=android.provider.Telephony.SMS_RECEIVED/>
    &所述; /意图滤光器>
< /接收器>

SMSReceiver成功接收,如果我的应用程序已安装并打开一次(应用程序并不需要在短信接收到设备的瞬间运行)的短信。但是,如果我不打开我的应用程序至少一次进行全新安装之后,它并没有收到任何短信。

有谁知道一种方法,使人们有可能接收短信没有至少一次打开应用程序?


解决方案

  

有谁知道一种方法,使人们有可能接收短信没有至少一次打开应用程序?


它不能做的,较新的Andr​​oid版本最少。自从Android的3.1,应用程序安装在的停止状态的,并要求用户组件之前,打开它至少一次,像你的广播接收器可以发挥作用。这是出于安全原因,prevent,或至少阻碍,恶意程序的行为。

I am trying to receive SMS from my android app. I have following receiver specified in my manifest.

<receiver android:exported="true" android:name="com.lahiruchandima.myapp.SMSReceiver">  
    <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>

SMSReceiver successfully receives SMS if my app is installed and opened once (app does not need to be running at the moment the SMS is received to the device). But, if i do not open my app at least once after a fresh install, it doesn't receive any SMS.

Does anybody know a way to make it possible to receive SMS without opening the app at least once?

解决方案

Does anybody know a way to make it possible to receive SMS without opening the app at least once?

It can't be done, on newer Android versions at least. Ever since Android 3.1, apps are installed in a stopped state, and require that the user open it at least once before components like your BroadcastReceiver can function. This is for security reasons, to prevent, or at least hamper, malicious program behavior.

这篇关于接收短信Android应用程序没有至少一次打开应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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