{"id":18554783,"url":"https://github.com/microg/android_external_unifiednlpapi","last_synced_at":"2025-04-09T23:31:51.815Z","repository":{"id":25263811,"uuid":"28689078","full_name":"microg/android_external_UnifiedNlpApi","owner":"microg","description":"API interfaces and helpers to create backends for UnifiedNlp","archived":false,"fork":false,"pushed_at":"2019-11-26T13:56:20.000Z","size":143,"stargazers_count":47,"open_issues_count":3,"forks_count":37,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-24T13:43:55.475Z","etag":null,"topics":["android","android-library","api","geocoder","geocoding","geolocation","java","microg","unifiednlp"],"latest_commit_sha":null,"homepage":"","language":"Java","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/microg.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}},"created_at":"2015-01-01T15:25:13.000Z","updated_at":"2024-11-21T21:58:13.000Z","dependencies_parsed_at":"2022-08-19T15:10:09.604Z","dependency_job_id":null,"html_url":"https://github.com/microg/android_external_UnifiedNlpApi","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microg%2Fandroid_external_UnifiedNlpApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microg%2Fandroid_external_UnifiedNlpApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microg%2Fandroid_external_UnifiedNlpApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microg%2Fandroid_external_UnifiedNlpApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microg","download_url":"https://codeload.github.com/microg/android_external_UnifiedNlpApi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248129865,"owners_count":21052652,"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":["android","android-library","api","geocoder","geocoding","geolocation","java","microg","unifiednlp"],"created_at":"2024-11-06T21:23:52.170Z","updated_at":"2025-04-09T23:31:49.930Z","avatar_url":"https://github.com/microg.png","language":"Java","readme":"UnifiedNlpApi\n=============\nThis library contains anything needed to build a backend for UnifiedNlp.\n\nWriting the service\n-------------------\n### The easy way (Location)\nWriting a service is fairly easy. Just create a class that extends `org.microg.nlp.api.LocationBackendService`, it provides several methods:\n\n#### `update()`-method\nYou'll most likely want to override this method. It is called every time when an application requests a location.\n\nHowever, as this method is blocking, you should not do heavy I/O operations (like network) in it.\nIf your backend uses a remote provider for location retrieval, do requests in an additional thread and return null in `update()`. \nOn request success, use `report()` to send the new location to the requesting application.\n\nSee JavaDoc for additional information.\n\n#### `onOpen()`-method and `onClose()`-method\nThese might be interesting to override too. `onOpen()` is called after UnifiedNlp connected to this backend and `onClose()` is called before connection closure.\nThis is a good place to initialize or respectively destroy whatever you need during `update()` calls.\n\n#### `report(Location)`-method\nYou can call this method every time to report the given location as soon as possible.\n\n### The easy way (Geocoding)\nProviding a Geocoder is even simpler than a LocationProvider. Extend `org.microg.nlp.api.GeocoderBackendService` and implement the methods `getFromLocation` and `getFromLocationName`.\nBoth methods reflect a call to the corresponding method in `android.location.Geocoder`.\n\n### The flexible way\nInstead of using the `LocationBackendService` helper class you can do it by hand. \nIt's important that your service overrides the `onBind()` method and responds with a `Binder` to the `LocationBackend` interface.\n\nAdvertise your service\n----------------------\nTo let UnifiedNlp see your service you need to advertise it by providing the `org.microg.nlp.LOCATION_BACKEND` action. \n\nFor security reasons, you should add an `android:permission` restriction to `android.permission.ACCESS_COARSE_LOCATION`. This ensures only application with access to coarse locations will be able to connect to your service.\n\nYou may want to set `android:icon` and `android:label` to something reasonable, else your applications icon/label are used.\nIf your backend has settings you can advertise it's activity using the `org.microg.nlp.BACKEND_SETTINGS_ACTIVITY` meta-data so that it is callable from the UnifiedNlp settings.\n\nA service entry for a backend service could be:\n\n\t\u003cservice\n\t\tandroid:name=\".SampleService\"\n\t\tandroid:exported=\"true\"\n\t\tandroid:permission=\"android.permission.ACCESS_COARSE_LOCATION\"\n\t\tandroid:label=\"A very nice Backend\"\u003e\n\t\t\u003cintent-filter\u003e\n\t\t\t\u003caction android:name=\"org.microg.nlp.LOCATION_BACKEND\" /\u003e\n\t\t\u003c/intent-filter\u003e\n\t\t\u003cmeta-data\n\t\t\tandroid:name=\"org.microg.nlp.BACKEND_SETTINGS_ACTIVITY\"\n\t\t\tandroid:value=\"org.microg.nlp.api.sample.SampleActivity\" /\u003e\n\t\u003c/service\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrog%2Fandroid_external_unifiednlpapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrog%2Fandroid_external_unifiednlpapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrog%2Fandroid_external_unifiednlpapi/lists"}