-
-
Save hitherejoe/aab83c0d5695de1528b0b9288b0826c0 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 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