Skip to content

Instantly share code, notes, and snippets.

@hitherejoe hitherejoe/ Secret
Last active Jul 12, 2016

What would you like to do?
class FenceReceiver extends BroadcastReceiver {
public static final String FENCE_RECEIVER_ACTION =
public void onReceive(Context context, Intent intent) {
FenceState fenceState = FenceState.extract(intent);
if (TextUtils.equals(fenceState.getFenceKey(), FENCE_KEY)) {
switch(fenceState.getCurrentState()) {
case FenceState.TRUE:
// We've entered the fence
case FenceState.FALSE:
// We're not in the fence
case FenceState.UNKNOWN:
// Something went wrong...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.