简体   繁体   English

在Android中收到短信时如何将应用程序置于前台

[英]How to bring application to foreground when SMS is received in Android

I have an application in android which receives SMS in a specific port. 我在android中有一个应用程序,该应用程序在特定端口中接收SMS。 When my application is not running or it is running in background, how can i get the application to foreground and receive the SMS automatically? 当我的应用程序未运行或在后台运行时,如何将应用程序置于前台并自动接收SMS? Currently it is not receiving an SMS when it is in background. 当前,它在后台时没有收到SMS。 The SMS is only received by the native Messages application. SMS仅由本机消息应用程序接收。

Also I want to use sendOrderedBroadcast because my messages should not be stored in native message inbox. 我也想使用sendOrderedBroadcast,因为我的消息不应存储在本机消息收件箱中。 So, i have to use sendOrderedBroadcast. 因此,我必须使用sendOrderedBroadcast。 Does anyone have an example code for how to do this? 是否有人有示例代码来执行此操作?

Thanks in advance 提前致谢

阅读这篇文章,我认为它可以为您提供帮助... http://android-journey.blogspot.com/2010/01/android-braodcast-receivers.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM