如何通过来自特定短信发送器(特定短信端口)的短信激活 Android 应用程序
我需要开发一个Android应用程序,它将接收来自特定发件人的短信,当收到短信时,该应用程序必须激活并获取短信附带的所有值,请给我答案?
I need to develop an Android App which will receive SMS from a Specific sender, when the SMS received, the App has to get activated and gets all the values which came with the SMS, please provide me the answer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 BroadcastReciver 来读取短信。并提取该短信并将值保存在 android 的数据库中。当您调用第一个活动时,检查数据库中包含的特定值,然后仅启动该活动。
此代码用于读取短信。
第一个活动的代码
位于 DataBase 类中。
我认为这对你有帮助......
You can use BroadcastReciver for reading sms. And extract that sms and save values in DataBase in android . When you call the first Activity check the particular value contains in the DataBase then only start the Activity.
This code for Reading SMS.
this code for the First Activity
This is in DataBase class.
I think thi is helpful for u....
使用广播接收器捕获所有传入消息。然而,初始化接收器的地点、时间和方式取决于您的应用程序。您可以在启动时或首次打开应用程序时执行此操作。
您必须扫描所有传入的短信,读取内容和号码,然后在应用程序内的某处检查并设置标志。
Use a broadcast receiver to capture all the incoming messages. However, where, when and how you initialize your receiver depends on your application. You can do it on boot, or on first open of your application etc.
You will have to scan all the incoming sms, read the content, and the number and check and set a flag somewhere inside your application.