1

我想创建一个服务来获取短信并将其写入文件,而不会中断处理短信的本机过程。

4

2 回答 2

1

像这样的东西?

http://www.androidcompetencycenter.com/2008/12/android-api-sms-handling/

于 2012-05-02T06:18:37.117 回答
1

Can you be more specific? Do you want to create your own service? Do you want to receive SMS and write that SMS to a file?

1st approach

In you application register Broadcast in Manifest. Never unregister that broadcast.

Once you receive your broadcast in onreceive() write to a file.

2nd approach

Create a service and in that service register a broadcast Once you receive ur broadcast in onreceive() write to a file.

Note: don't unregister your broadcast in onDestroy() of your Service. Keep it alive.

You can check this link:

http://www.apriorit.com/our-company/dev-blog/227-handle-sms-on-android

于 2012-05-02T06:31:33.590 回答