{"id":21366376,"url":"https://github.com/prana10/downloadersample","last_synced_at":"2026-04-24T12:04:49.135Z","repository":{"id":197700007,"uuid":"698164630","full_name":"prana10/downloadersample","owner":"prana10","description":"Sample Downloader Using WorkManager \u0026 HttpURLConnection in Java","archived":false,"fork":false,"pushed_at":"2023-10-02T03:35:55.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T07:42:53.170Z","etag":null,"topics":["android","httpurlconnection","java","workmanager"],"latest_commit_sha":null,"homepage":"","language":"Java","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/prana10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-29T09:53:58.000Z","updated_at":"2024-08-23T18:14:52.000Z","dependencies_parsed_at":"2023-10-02T04:21:10.198Z","dependency_job_id":"4c9da35c-7501-459a-9d0b-023b24b30193","html_url":"https://github.com/prana10/downloadersample","commit_stats":null,"previous_names":["prana10/downloadersample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prana10/downloadersample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prana10%2Fdownloadersample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prana10%2Fdownloadersample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prana10%2Fdownloadersample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prana10%2Fdownloadersample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prana10","download_url":"https://codeload.github.com/prana10/downloadersample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prana10%2Fdownloadersample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261792407,"owners_count":23210312,"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","httpurlconnection","java","workmanager"],"created_at":"2024-11-22T07:14:48.915Z","updated_at":"2026-04-24T12:04:44.095Z","avatar_url":"https://github.com/prana10.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Downloader Sample\nSample Downloader Using WorkManager \u0026amp; HttpURLConnection in Java\n\n# How To Use\nTo use this project. Please change the URL in the MainActivity.java file\n```java\n @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n\n        // isi dengan url file zip yang ingin di download\n        // pastikan cek url nya secara benar agar file bisa di download\n        String url = \"\";\n\n        // file lokasi output berada di : /data/user/0/com.garyle.downloadersample/files/file.zip\n        // ganti ekstensi file .zip nya dengan file yang ingin di download\n        String outputFilePath = getFilesDir().getAbsolutePath() + \"/file.zip\";\n\n        Data inputData = new Data.Builder()\n                .putString(\"file_url\", url)\n                .putString(\"output_file_path\", outputFilePath)\n                .build();\n\n        OneTimeWorkRequest downloadWorkRequest = new OneTimeWorkRequest.Builder(DownloadWorker.class)\n                .setConstraints(new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build())\n                .setInputData(inputData)\n                .build();\n\n        triggerDownloadOnWiFi(downloadWorkRequest);\n    }\n```\nAdjust the file extension to the file you want to download.\n\n## To modify the notification, please visit the DownloadWorker.java file.\nPlease customize the Icon, Title, and Content text as you wish.\n```java\nprivate void showNotification(String message, int notificationId) {\n        NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);\n\n        NotificationChannel channel = new NotificationChannel(\n                CHANNEL_ID,\n                \"downloader_notification_sample_channel\",\n                NotificationManager.IMPORTANCE_DEFAULT\n        );\n\n        notificationManager.createNotificationChannel(channel);\n\n        NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID)\n                .setSmallIcon(R.drawable.ic_launcher_foreground)\n                .setContentTitle(\"Download Status\")\n                .setContentText(message)\n                .setPriority(NotificationCompat.PRIORITY_DEFAULT);\n\n        notificationManager.notify(notificationId, builder.build());\n    }\n```\n## Acknowledgements\n- [background Work with WorkManager in Java](https://developer.android.com/codelabs/android-workmanager-java#0)\n- [HttpURLConnection Reference](https://developer.android.com/reference/java/net/HttpURLConnection)\n- [WorkManager Reference](https://developer.android.com/reference/androidx/work/WorkManager)\n\n# Authors\n- [@dhika_prana](https://www.instagram.com/dhika_prana/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprana10%2Fdownloadersample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprana10%2Fdownloadersample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprana10%2Fdownloadersample/lists"}