Created
June 4, 2018 03:22
-
-
Save ashwin-sp/3e97a846ba43fa798183ab4b959ede7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyReceiver : BroadcastReceiver() { | |
companion object { | |
var CHECKED = "CHECKED" | |
} | |
override fun onReceive(context: Context, intent: Intent) { | |
if(intent.hasExtra(CHECKED)) | |
{ | |
MySliceProvider.state = intent.getBooleanExtra(CHECKED,state) | |
println("State at receiver $state") | |
val i = Intent("stateBroadcast") | |
i.putExtra(CHECKED, state) | |
context.contentResolver.notifyChange(MySliceProvider.getUri(context,"/"), null) | |
context.sendBroadcast(i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment