{"id":18270263,"url":"https://github.com/casidiablo/groundy","last_synced_at":"2025-04-04T23:31:52.901Z","repository":{"id":7126296,"uuid":"8421539","full_name":"casidiablo/groundy","owner":"casidiablo","description":"Sexy way to execute async/background tasks on Android","archived":false,"fork":true,"pushed_at":"2016-04-17T19:01:26.000Z","size":805,"stargazers_count":126,"open_issues_count":0,"forks_count":19,"subscribers_count":18,"default_branch":"develop","last_synced_at":"2025-04-02T02:06:18.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://telly.github.io/groundy","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"telly/groundy","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casidiablo.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":"2013-02-26T00:23:19.000Z","updated_at":"2025-01-27T08:31:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/casidiablo/groundy","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fgroundy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fgroundy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fgroundy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fgroundy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casidiablo","download_url":"https://codeload.github.com/casidiablo/groundy/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266476,"owners_count":20910831,"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-05T11:38:27.968Z","updated_at":"2025-04-04T23:31:51.627Z","avatar_url":"https://github.com/casidiablo.png","language":"Java","readme":"Groundy library for Android\n===========================\n\n![Groundy](http://i.imgur.com/2xg2weE.png)\n\nGroundy is a fun, sexy way to do background work on your Android app; it's specially useful for\nrunning tasks that must be executed even if your activities/fragments are destroyed. It allows\nyou to receive notifications from the background task directly to your activity or any object.\n\nIt is useful for several scenarios like executing calls to external services (e.g. RESTful web\nservices), download and/or process files, encoding audio/video and any kind of task that could\nblock the main thread.\n\nBasic usage\n===========\n\nCreate a subclass of `GroundyTask`:\n\n```java\npublic class ExampleTask extends GroundyTask {\n  @Override\n  protected TaskResult doInBackground() {\n    // you can send parameters to the task using a Bundle (optional)\n    String exampleParam = getStringArg(\"arg_name\");\n\n    // lots of code\n\n    // return a TaskResult depending on the success of your task\n    // and optionally pass some results back\n    return succeeded().add(\"the_result\", \"some result\");\n  }\n}\n```\n\nWhenever you want to execute the task, just do this:\n\n```java\n// this is usually performed from within an Activity\nGroundy.create(ExampleTask.class)\n    .callback(callbackObj)        // required if you want to get notified of your task lifecycle\n    .arg(\"arg_name\", \"foo\")       // optional\n    .queueUsing(YourActivity.this);\n```\n\nYou will get results in your callback object(s) (in the main thread):\n\n```java\n@OnSuccess(ExampleTask.class)\npublic void onSuccess(@Param(\"the_result\") String result) {\n  // do something with the result\n}\n```\n\nDo not forget to add `GroundyService` to the `AndroidManifest.xml` file:\n\n```xml\n\u003cservice android:name=\"com.telly.groundy.GroundyService\"/\u003e\n```\n\nExtending callback system\n=========================\n\nThere are some already defined onCallback annotations: `@OnSuccess`, `@OnFailed`, `@OnCancel`,\n`@OnProgress` and `@OnStart`, but you can also create your own callback types like:\n\n```java\n@OnCallback(task = ChuckTask.class, name = \"kick\")\npublic void onChuckNorrisAttack(@Param(\"target\") String target) {\n  Toast.makeText(this, \"Chuck Norris kicked your \" + target, Toast.LENGTH_SHORT).show();\n}\n```\n\nTake a look at the custom callbacks example for details on this.\n\nIntegration\n===========\n\nIn order to use this library from you Android project using **Maven** your pom should look like this:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.telly\u003c/groupId\u003e\n  \u003cartifactId\u003egroundy\u003c/artifactId\u003e\n  \u003cversion\u003e(insert latest version)\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- enables groundy JSR-269 processor which makes everything up to 5 times faster --\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.telly\u003c/groupId\u003e\n  \u003cartifactId\u003egroundy-compiler\u003c/artifactId\u003e\n  \u003cversion\u003e(insert latest version)\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor **Gradle** projects use:\n\n```groovy\ncompile 'com.telly:groundy:(insert latest version)'\ncompile 'com.telly:groundy-compiler:(insert latest version)'\n```\n\nAt this point latest version is `1.5`.\n\nProguard\n========\n\nIf you are using proguard, please add these rules\n\n```txt\n-keepattributes *Annotation*\n\n-keepclassmembers,allowobfuscation class * {\n    @com.telly.groundy.annotations.* *;\n    \u003cinit\u003e();\n}\n\n-keepnames class com.telly.groundy.generated.*\n-keep class com.telly.groundy.generated.*\n-keep class com.telly.groundy.ResultProxy\n-keepnames class * extends com.telly.groundy.ResultProxy\n-keep class * extends com.telly.groundy.GroundyTask\n```","funding_links":[],"categories":["etc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasidiablo%2Fgroundy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasidiablo%2Fgroundy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasidiablo%2Fgroundy/lists"}