{"id":20082404,"url":"https://github.com/googlesamples/subgraph_sdk_sample","last_synced_at":"2025-06-14T15:05:31.939Z","repository":{"id":83025234,"uuid":"578439320","full_name":"googlesamples/subgraph_sdk_sample","owner":"googlesamples","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-25T16:29:58.000Z","size":289,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-06T00:38:06.013Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googlesamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2022-12-15T03:54:35.000Z","updated_at":"2024-05-30T09:51:23.000Z","dependencies_parsed_at":"2024-11-13T15:46:43.086Z","dependency_job_id":"a8efb5e2-b8cd-4770-b46c-921ea70d4c02","html_url":"https://github.com/googlesamples/subgraph_sdk_sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/googlesamples/subgraph_sdk_sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fsubgraph_sdk_sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fsubgraph_sdk_sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fsubgraph_sdk_sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fsubgraph_sdk_sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googlesamples","download_url":"https://codeload.github.com/googlesamples/subgraph_sdk_sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fsubgraph_sdk_sample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259835391,"owners_count":22918980,"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-13T15:43:16.476Z","updated_at":"2025-06-14T15:05:31.922Z","avatar_url":"https://github.com/googlesamples.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"Subgraph SDK Sample\n===================\n\n\nIntroduction\n------------\n\nThis is the initial Subgraph SDK Sample that will receive an Intent from a\nNotifyUser call from the carrier interface. It is still in development.\n\n\nGetting started\n---------------\n\nThe Sample uses the google() repository so it can load the current version of\nthe maven artifact, referenced in the app's build.gradle file.\n\nThe small kotlin sample on how to reference and use the api is inside:\n\njava/com/google/samples/quickstart/subgraph_sdk_sample/MainActivity.kt (Kotlin)\n\nJava usage will be very similar.\n\nThe carrier will send a NotifyUser RPC, which will direct the message to the SDK\nthat will then launch the destination_package indicated by the RPC call.\n\nThe SDK will allow getting the current CPID for the carrier.\n\nThis package should be this following target, or any other valid target\nconfigured for your carrier:\n\ncom.google.samples.quickstart.subgraph_sdk_sample\n\n\n1. This activity will have a data payload that was sent by the NotifyUser RPC.\n   Details on how to send the RPC will be provided at a later time. Be sure the\n   activity launch mode allows for a completely new intent to be delivered to\n   onCreate() and onNewIntent(). Once the new intent arrives, the following\n\n   ~~~~\n   var parsedIntent = Subgraph.fromIntent(intent)\n   ~~~~\n\n   is a helper function that will parse out the contents for use in the app.\n\n1. Obtain an instance of the MobileDataPlanClient from Subgraph.\n   See the example in [MainActivity.kt](https://github.com/googlesamples/subgraph_sdk_sample/blob/main/app/src/main/java/com/google/samples/quickstart/subgraph_sdk_sample/MainActivity.kt).\n\n   It should be created in a background thread, but can be also be stored\n   outside that scope.\n\n   ~~~~\n   launch {\n     var mobileDataPlanClient =\n       Subgraph.newMobileDataPlanClient(applicationContext, parsedIntent.simId())\n   }\n   ~~~~\n\n   With this client, the app can get the current Carrier Plan ID. Run it in a\n   background thread, as it is a blocking call. See sample with a more complete\n   example.\n\n   ~~~~\n   launch {\n     var dataPlanIdentifier = mobileDataPlanClient?.cpid\n   }\n   ~~~~\n\n   dataPlanIdentifier contains the current cpid() and the simId() corresponding\n   to that cpid. updateTime() for that CPID is also available.\n\n   Both Kotlin and Java can also use Guava's ListenableFuture with FluentFuture\n   or onSuccess callbacks for more thread execution control options.\n\n1. Also add cleanup to the activity lifecycle, such as at onDestroy()\n\n   ~~~~\n   mobileDataPlanClient?.close()\n   ~~~~\n\n1. The notification importance level is set to \"HIGH_IMPORTANCE\". Ask the user\n   for permission:\n   https://developer.android.com/training/permissions/requesting#request-permission\n\n   If the permission for POST_NOTIFICATIONS is already disabled, display a UI\n   explaining why the feature is useful, then ask the user to enable it if the\n   feature is useful to them. The notifications UI for the system, is located\n   here:\n\n   Settings --\u003e Notifications --\u003e All Apps --\u003e (your application name) --\u003e\n   All (your application name) notifications.\n\n   Set them all to enabled.\n\n1. Call \"resumeNotifications()\" to receive notifications. Also be sure to enable\n   notifications in settings. By default, no notifications will be displayed.\n\n   It is possible to resume and stop notifications. This can be tied to the\n   application or service lifecycles.\n\n   The following return a Future, but should be run in a background thread\n   wait for completion if that is important for the app design.\n\n   ~~~\n   // onResume(), logIn(), etc.\n   mobileDataPlanClient?.resumeNotifications();\n\n   // onPause(), logOut(), etc.\n   mobileDataPlanClient?.stopNotifications();\n   ~~~\n\nThis project uses the Gradle build system. To build this project, use the\n`gradlew build` command or use \"Import Project\" in Android Studio.\n\nFor more resources on learning Android development, visit the\n[Developer Guides](https://developer.android.com/guide/) at\n[developer.android.com](https://developer.android.com).\n\n### Required setup\n\nThe subgraph_sdk_sample will have this setup already. Subgraph SDK will be in\nthe google() repository:\n\n~~~~\nrepositories {\n  google()\n  // ...\n}\n~~~~\n\nIn your app directory's build.gradle, add to the dependencies this line:\n\n~~~~\ndependencies {\n  implementation 'com.google.android.libraries.cloud.telco.subgraph:cloud_telco_subgraph:0.5.3'\n}\n~~~~\n\nThe android gradle plugin may need to be updated to at least version 7.3.1 when\nthe sample is first loaded. Upgrade when prompted by Android Studio.\n\nIf the app does not already have an OSS plugin to help with Third Party\nLicenses generation and display, please go here:\n\nhttps://developers.google.com/android/guides/opensource\n\nSupport\n-------\n\nPlease report issues with this sample in this project's issues page:\nhttps://github.com/googlesamples/subgraph-sdk-sample/issues\n\nLicense\n-------\n\n```\nCopyright 2022 Google, Inc.\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor\nlicense agreements.  See the NOTICE file distributed with this work for\nadditional information regarding copyright ownership.  The ASF licenses this\nfile to you under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License.  You may obtain a copy of\nthe License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglesamples%2Fsubgraph_sdk_sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglesamples%2Fsubgraph_sdk_sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglesamples%2Fsubgraph_sdk_sample/lists"}