【问题标题】:Is there is a way to for activity to communicate a service which start the activity?有没有办法让活动与启动活动的服务进行通信?
【发布时间】:2020-11-13 22:44:50
【问题描述】:

我有一个服务,它有一个回调函数,用于检测剪贴板中的变化,其中回调有一个pendingIntent,它被通知使用,稍后通知用于在单击通知后启动活动。所以这是我的问题,那么一旦启动活动,启动的活动是否有可能通知回服务(一种方式通信就可以了)?

【问题讨论】:

标签: android android-activity android-service


【解决方案1】:

您可以从Activity 发送广播Intent 以通知ServiceService 应该注册一个BroadcastReceiver,它将由广播Intent 触发。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-09
    • 2015-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多