{"id":21884666,"url":"https://github.com/onehilltech/android-gatekeeper","last_synced_at":"2025-07-12T02:33:31.486Z","repository":{"id":77815096,"uuid":"43791061","full_name":"onehilltech/android-gatekeeper","owner":"onehilltech","description":"Gatekeeper support library for Android","archived":false,"fork":false,"pushed_at":"2017-09-21T06:12:23.000Z","size":1257,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T07:19:27.775Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onehilltech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-10-07T02:35:10.000Z","updated_at":"2019-08-23T13:09:24.000Z","dependencies_parsed_at":"2023-03-03T04:00:31.191Z","dependency_job_id":null,"html_url":"https://github.com/onehilltech/android-gatekeeper","commit_stats":null,"previous_names":[],"tags_count":118,"template":false,"template_full_name":null,"purl":"pkg:github/onehilltech/android-gatekeeper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onehilltech%2Fandroid-gatekeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onehilltech%2Fandroid-gatekeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onehilltech%2Fandroid-gatekeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onehilltech%2Fandroid-gatekeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onehilltech","download_url":"https://codeload.github.com/onehilltech/android-gatekeeper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onehilltech%2Fandroid-gatekeeper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264925522,"owners_count":23684167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T10:15:16.737Z","updated_at":"2025-07-12T02:33:31.437Z","avatar_url":"https://github.com/onehilltech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"android-gatekeeper\n==================\n\n[![Download](https://jitpack.io/v/onehilltech/android-gatekeeper.svg)](https://jitpack.io/#onehilltech/android-gatekeeper)\n[![Build Status](https://travis-ci.org/onehilltech/android-gatekeeper.svg)](https://travis-ci.org/onehilltech/android-gatekeeper)\n\nGatekeeper support library for Android.\n\n## Installation\n\n#### Gradle\n\n```\nbuildscript {\n  repositories {\n    maven { url \"https://jitpack.io\" }\n  }\n}\n\ndependencies {\n  compile com.github.onehilltech:android-gatekeeper:x.y.z\n}\n```\n\n## Getting Started\n\n### Configuring meta-data in AndroidManifest.xml\n\nUse the `gatekeeper-cli` to add a new client that represents the mobile application to \nthe database. Then, define the following values in `strings.xml`:\n\n```xml\n\u003c!-- make sure to add trailing / --\u003e\n\u003cresources\u003e\n  \u003c!-- // other things --\u003e\n  \n  \u003cstring name=\"gatekeeper_baseuri\"\u003eURL for Gatekeeper\u003c/string\u003e\n\n  \u003c!-- values generated by gatekeeper-cli --\u003e\n  \u003cstring name=\"gatekeeper_client_id\"\u003eCLIENT ID\u003c/string\u003e\n  \u003cstring name=\"gatekeeper_client_secret\"\u003eCLIENT SECRET\u003c/string\u003e\n\u003c/resources\u003e  \n```\n\nThe strings then need to be referenced as meta-data in `AndroidManifest.xml`.\n\n```xml\n\u003capplication\u003e\n  \u003c!-- // other things --\u003e\n  \n  \u003c!-- Gatekeeper metadata --\u003e\n  \u003cmeta-data\n      android:name=\"com.onehilltech.gatekeeper.android.baseuri\"\n      android:resource=\"@string/gatekeeper_baseuri\"/\u003e\n\n  \u003cmeta-data\n      android:name=\"com.onehilltech.gatekeeper.android.client_id\"\n      android:resource=\"@string/gatekeeper_client_id\"/\u003e\n\n  \u003cmeta-data\n      android:name=\"com.onehilltech.gatekeeper.android.client_secret\"\n      android:resource=\"@string/gatekeeper_client_secret\"/\u003e\n\u003c/application\u003e\n```\n\n### Initialize Gatekeeper in the application\n\nUpdate your `Application` class to call `Gatekeeper.init (context)`. You must also\ninitialize [DBFlow](https://github.com/Raizlabs/DBFlow).\n\n```javascript\npublic class TheApplication extends Application\n{\n  @Override\n  public void onCreate ()\n  {\n    super.onCreate ();\n\n    FlowManager.init (\n        new FlowConfig.Builder (this)\n            .openDatabasesOnInit (true)\n            .build ());\n\n    // Initialize Gatekeeper\n    Gatekeeper.initialize (this);\n  }\n}\n```\n\n### Login / New account activity \n\nExport the default activities for login and creating a new account, if applicable, to \n`AndroidManifest.xml`.\n\n```xml\n\u003cactivity android:name=\"com.onehilltech.gatekeeper.android.SingleUserLoginActivity\" /\u003e\n\u003cactivity android:name=\"com.onehilltech.gatekeeper.android.NewAccountActivity\" /\u003e\n```\n\n### Protecting activities\n\nLast, we need to protect the activities that require login. Create a\n`SingleUserSessionClient` in each activity, and make sure the user is \nlogged in before continuing on the `Activity.onStart()` method. This \nwill ensure that regardless of how the user enter the application, they \nmust be logged in.\n\n```java\npublic class MyActivity extends AppCompatActivity\n  implements SingleUserSessionClient.Listener\n{\n  private SingleUserSessionClient session_;\n\n  @Override\n  protected void onCreate (@Nullable Bundle savedInstanceState)\n  {\n    super.onCreate (savedInstanceState);\n\n    this.setContentView (R.layout.activity_main);\n\n    this.session_ = new SingleUserSessionClient.Builder (this).build ();\n    this.session_.setListener (this);\n  }\n\n  @Override\n  protected void onStart ()\n  {\n    super.onStart ();\n\n    // Make sure the user it logged in.\n    this.session_.checkLoggedIn (this, SingleUserLoginActivity.class);\n    \n    // If you do not want create a SingleUserSessionClient object, \n    // then use:\n    //\n    // SingleUserSessionClient.ensureLoggedIn (this, SingleUserLoginActivity.class);\n  }\n\n  @Override\n  public void onLogin (SingleUserSessionClient client)\n  {\n    // Handle the user logging in\n  }\n\n  @Override\n  public void onLogout (SingleUserSessionClient client)\n  {\n    // Handle the user logging out\n  }\n}\n```\n\n## Custom Activities\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonehilltech%2Fandroid-gatekeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonehilltech%2Fandroid-gatekeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonehilltech%2Fandroid-gatekeeper/lists"}