Call activity method from broadcast receiver android?

后端 未结 5 1826
猫巷女王i
猫巷女王i 2021-01-07 15:19

In my application I am sending a port SMS to the mobile. And when the message is recieved I need to perform some task in my activity and update the UI.

Manifest Decl

5条回答
  •  醉酒成梦
    2021-01-07 16:10

    The Context that your BinarySMSReceiver is passed in onReceive is not an Activity - it is the Context in which the receiver is running. To start an Activity, you need to use context.startActivity(Intent) and pass any additional data to the Activity using the Intent.

提交回复
热议问题