{"id":25510546,"url":"https://github.com/leoando/android-trustedtime-samples","last_synced_at":"2025-08-25T06:34:45.648Z","repository":{"id":277601815,"uuid":"932861371","full_name":"LeoAndo/android-trustedtime-samples","owner":"LeoAndo","description":"Sample for TrustedTime API","archived":false,"fork":false,"pushed_at":"2025-02-17T13:02:33.000Z","size":410,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T10:11:37.902Z","etag":null,"topics":["android-compose","android-java","android-kotlin","trusted-timestamping","trustedtime","trustedtime-api"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeoAndo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"LeoAndo"}},"created_at":"2025-02-14T16:50:58.000Z","updated_at":"2025-02-17T13:02:37.000Z","dependencies_parsed_at":"2025-02-14T21:29:45.250Z","dependency_job_id":"cc41fdfd-dda3-43f3-a851-703e43657be4","html_url":"https://github.com/LeoAndo/android-trustedtime-samples","commit_stats":null,"previous_names":["leoando/android-trustedtime-samples"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LeoAndo/android-trustedtime-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoAndo%2Fandroid-trustedtime-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoAndo%2Fandroid-trustedtime-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoAndo%2Fandroid-trustedtime-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoAndo%2Fandroid-trustedtime-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeoAndo","download_url":"https://codeload.github.com/LeoAndo/android-trustedtime-samples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoAndo%2Fandroid-trustedtime-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272013588,"owners_count":24858478,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android-compose","android-java","android-kotlin","trusted-timestamping","trustedtime","trustedtime-api"],"created_at":"2025-02-19T09:51:17.947Z","updated_at":"2025-08-25T06:34:45.626Z","avatar_url":"https://github.com/LeoAndo.png","language":"Kotlin","readme":"# overview\nAccurate time is crucial for a wide variety of app functionalities, from scheduling and event management to transaction logging and security protocols. However, a user can change the device’s time, so a more accurate source of time than the device’s local system time may be required. That's why we're introducing the TrustedTime API that leverages Google's infrastructure to deliver a trustworthy timestamp, independent of the device's potentially manipulated local time settings.\n\nTrustedTime periodically syncs its clock to Google's servers, which have access to a highly accurate time source, so that you do not need to make a server request every time you want to know the current network time. \n\n# dev memo\nIf you use Dagger Hilt to handle an instance of Task in ApplicationScope, ensure that Google Play Service is up to date when the app starts. If Google Play Service is disabled or otherwise unavailable at startup, it is safe to have the mechanism that displays a dialog prompting the user to update. \n\nBased on the above, I think it is a good idea to use Dagger Hilt to handle an instance of Task\u003cTrustedTimeClient\u003e in ActivityScope.\n\nIn that case, it is easy to handle if you call it in Coroutine as needed in the Activity you are using, as in the code below.\nhttps://github.com/LeoAndo/android-trustedtime-samples/blob/main/ComposeHiltSample/app/src/main/java/com/example/composesample/ActivityModule.kt\n\n# Android Studio\n```\nAndroid Studio Meerkat Feature Drop | 2024.3.2 Nightly 2025-02-14\n```\n# coding flow\nhttps://github.com/LeoAndo/android-trustedtime-samples/pull/1\u003cbr\u003e\nhttps://github.com/LeoAndo/android-trustedtime-samples/pull/3\u003cbr\u003e\nhttps://github.com/LeoAndo/android-trustedtime-samples/pull/5\u003cbr\u003e\n\n# my best project\nhttps://github.com/LeoAndo/android-trustedtime-samples/tree/main/ComposeHiltSample\n\n# capture: Pixel 9 Pro Fold API Baklava Preview\n\n| java | kotlin | compose |\n|:---|:---:|:---:|\n|\u003cimg src=\"./JavaSample/img.png\" width=320 /\u003e |\u003cimg src=\"./KotlinSample/img.png\" width=320 /\u003e |\u003cimg src=\"./ComposeSample/img_1.png\" width=320 /\u003e |\n\n| 1 | 2 |\n|:---|:---:|\n|\u003cimg src=\"./ComposeSample/img_2.png\" width=320 /\u003e |\u003cimg src=\"./ComposeSample/img_3.png\" width=320 /\u003e |\n\n# refs\nhttps://android-developers.googleblog.com/2025/02/trustedtime-api-introducing-reliable-approach-to-time-keeping-for-apps.html\n","funding_links":["https://github.com/sponsors/LeoAndo"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoando%2Fandroid-trustedtime-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleoando%2Fandroid-trustedtime-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoando%2Fandroid-trustedtime-samples/lists"}