{"id":15018543,"url":"https://github.com/nativescript/sample-ios-background-execution","last_synced_at":"2025-10-19T16:31:15.291Z","repository":{"id":141979919,"uuid":"65206076","full_name":"NativeScript/sample-ios-background-execution","owner":"NativeScript","description":"Running Custom Background Tasks with NativeScript","archived":false,"fork":false,"pushed_at":"2019-10-24T15:25:33.000Z","size":1740,"stargazers_count":37,"open_issues_count":3,"forks_count":8,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-10-29T15:51:55.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/NativeScript.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":"2016-08-08T13:23:45.000Z","updated_at":"2024-09-07T00:00:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"699eac57-0836-47a2-bafe-01ec6d3cfe28","html_url":"https://github.com/NativeScript/sample-ios-background-execution","commit_stats":{"total_commits":13,"total_committers":6,"mean_commits":"2.1666666666666665","dds":0.5384615384615384,"last_synced_commit":"e913b664372ab4938e7ef930de7e2d269b821680"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-ios-background-execution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-ios-background-execution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-ios-background-execution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-ios-background-execution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NativeScript","download_url":"https://codeload.github.com/NativeScript/sample-ios-background-execution/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237163255,"owners_count":19265240,"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-09-24T19:52:05.836Z","updated_at":"2025-10-19T16:31:09.954Z","avatar_url":"https://github.com/NativeScript.png","language":"JavaScript","readme":"# Running Custom Background Task\n\nFor Android sample project please see this repo - https://github.com/NativeScript/sample-android-background-services\n\nA sample project demonstrating how NativeScript application can execute JavaScript code while the app is in background state. On `applicationDidEnterBackground` the app starts a custom [background task](https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html). It uses the `NSTimer` API to print a console message on a fixed time interval. To start the task press the `Home` button in order to move the app to the background.\n\n\n\u003e Since iOS doesn't allow a general-purpose background task to run forever, such a task will be suspended by the operating system after [approximately 3 minutes](http://stackoverflow.com/questions/28275415/how-long-does-apple-permit-a-background-task-to-run). In some special cases your task is allowed to run longer, but you need to use [UIBackgroundModes](https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH4-SW23) in your `Info.plist` file to specify the intent of your task (which automatically makes it not general-purpose).\n\n\n# Running the sample\n```shell\n    git clone https://github.com/NativeScript/sample-ios-background-execution.git\n    cd sample-ios-background-execution\n    npm install\n    tns run ios\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fsample-ios-background-execution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnativescript%2Fsample-ios-background-execution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fsample-ios-background-execution/lists"}