Skip to content

Instantly share code, notes, and snippets.

@hitherejoe hitherejoe/FenceReceiver.java Secret
Last active Jul 12, 2016

Embed
What would you like to do?
class FenceReceiver extends BroadcastReceiver {
public static final String FENCE_RECEIVER_ACTION =
"com.hitherejoe.aware.ui.fence.FenceReceiver.FENCE_RECEIVER_ACTION";
@Override
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
break;
case FenceState.FALSE:
// We're not in the fence
break;
case FenceState.UNKNOWN:
// Something went wrong...
break;
}
}
}
}
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.