Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Last active June 22, 2017 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronj1335/ca9e59e2284c53d99e373cbb760e9b60 to your computer and use it in GitHub Desktop.
Save aaronj1335/ca9e59e2284c53d99e373cbb760e9b60 to your computer and use it in GitHub Desktop.
class GuardedSafetyNetClient {
private final SafetyNetClient client;
private GuardedSafetyNetClient(Context context) {
client = SafetyNet.getClient(context);
}
public static SafetyNetClient getClient(Context context) {
return new GuardedSafetyNetClient(context);
}
public Task<SafeBrowsingResponse> lookupUri(String uri, String apiKey, int... threatTypes) {
return GoogleApiAvailability.isGooglePlayServicesAvailable(getContext())?
lookupUri(uri, apiKey, threatTypes) : Tasks.forException(new WhateverException("..."));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment