监听 CallLog.Calls 中的变化

发布于 2024-10-08 05:18:12 字数 278 浏览 0 评论 0原文

我正在构建一个应用程序来侦听 CallLog.Calls 内容提供程序中的更改。因此,此内容提供程序上的任何更改都会通知应用程序的观察者,该观察者将插入已更改的数据。

但有一个问题,应用程序在未运行时会收到通知,即应用程序不会捕获未运行时发生的数据变化。

所以我的问题是,有没有办法捕获应用程序未运行时更改的数据?例如,我拨打了 8 个电话,但应用程序未运行,因此 8 个新数据已添加到 CallLog.calls 内容提供程序中。那么有没有办法在应用程序启动后捕获这 8 个新数据呢?

谢谢!

I'm building an app that listen for changes in the CallLog.Calls content provider. So any changes on this content provider will notify the the app's observer, that will insert the data has changed.

But there is a problem, the app is notified when its not running, ie, the app will not capture the data has changed while not running.

So my question is, is there a way to capture the data that changed while the app was not running? So, example, I made 8 calls, and the app was not running, so 8 new data has been added to the CallLog.calls content provider. So is there a way to capture this 8 new data once the application starts?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缱倦旧时光 2024-10-15 05:18:12

如果有一个 Intent 在来电时触发,您可以使用 BroadcastReceiver 让您的应用做出响应,并在您的应用程序中创建一个 IntentFilter显现。

或者只是在应用程序启动时查询提供商...

编辑:

ACTION_PHONE_STATE_CHANGED 是一个 TelephonyManager 意图,您可以监听并检查它是否是 TelephonyManager.CALL_STATE_RINGING代码>.

If there is an Intent that is fired on an incoming call you could get your app to respond by using a BroadcastReceiver and create an IntentFilter in your manifest.

Or just query the provider when your app launches...

Edit:

ACTION_PHONE_STATE_CHANGED is a TelephonyManager intent you can listen for and check if it is TelephonyManager.CALL_STATE_RINGING.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文