{"id":21044634,"url":"https://github.com/tripflex/fix-back-button-android","last_synced_at":"2025-03-13T22:10:32.747Z","repository":{"id":147531799,"uuid":"102019213","full_name":"tripflex/fix-back-button-android","owner":"tripflex","description":"Meteor package for fixing the native back button on Android to suspend when back button pressed on root page","archived":false,"fork":false,"pushed_at":"2017-08-31T16:36:47.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T17:33:05.007Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tripflex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-08-31T16:02:34.000Z","updated_at":"2020-05-22T10:36:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac719350-9988-4d53-88e9-d9f6ab906423","html_url":"https://github.com/tripflex/fix-back-button-android","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripflex%2Ffix-back-button-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripflex%2Ffix-back-button-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripflex%2Ffix-back-button-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripflex%2Ffix-back-button-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tripflex","download_url":"https://codeload.github.com/tripflex/fix-back-button-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489898,"owners_count":20299001,"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-19T14:18:00.010Z","updated_at":"2025-03-13T22:10:32.741Z","avatar_url":"https://github.com/tripflex.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fix-back-button-android\nMeteor package for fixing the native back button on Android\n\nThis is a fork of the remcoder version, which fixes the cordova dependency which is no longer available on npm (and causes failure on meteor)\n\n## Quick start\nJust add this package and you're good to go:\n\n    meteor add tripflex:fix-back-button-android\n\n## The problem\nWhen you run a meteor app on Android, it suffers from a broken back button.\nApparently the Cordova wrapper causes a redirect when initially loading the app.\nThis means that you can't use the back button to get out of the app as normal on Android.\nSometimes you can get out when you press the back button repeatedly\nand sometimes you can't get out at all and you'll just see your app reloading.\n\nThis package has been updated to only suspend when on the root page of the meteor app\n\n\n## The solution (NEW \u0026 Recommended)\nTo resolve this we can handle the back button event ourselves and force the app to suspend.\nhttps://stackoverflow.com/questions/28055836/back-button-in-cordova-phongap-meteor-build-for-android-wont-close-application\n\nIf you do not want to install this package, you can add the org.android.tools.suspend plugin using this command:\n```shell\nmeteor add cordova:org.android.tools.suspend@https://github.com/Lamerchun/org.android.tools.suspend.git#0dbb52cca0244ba22a8c7975895f0f45d2e9a4a9\n```\n\n    // requires Suspend plugin (org.android.tools.suspend)\n    // see: https://github.com/Lamerchun/org.android.tools.suspend\n    // meteor add cordova:org.android.tools.suspend@https://github.com/Lamerchun/org.android.tools.suspend.git#0dbb52cca0244ba22a8c7975895f0f45d2e9a4a9\n    Meteor.startup(function(){\n        if(Meteor.isCordova) {\n            window.onpopstate = function () {\n                if (history.state \u0026\u0026 history.state.initial === true) {\n                    // You can also exit the app (instead of suspending)\n                    //navigator.app.exitApp();\n                    window.plugins.Suspend.suspendApp();\n                }\n            };\n\n        }\n\n       // Any other startup code below here\n    });\n\n\n\n## The solution (old)\nTo resolve this we can handle the back button event ourselves and force the app to suspend (this is the old repo method, and left here for reference, this package uses the method above)\n\n    // requires Suspend plugin (org.android.tools.suspend)\n    // see: https://github.com/Lamerchun/org.android.tools.suspend\n    Meteor.startup(function() {\n      if (Meteor.isCordova)\n        document.addEventListener(\"backbutton\", function () {\n          window.plugins.Suspend.suspendApp();\n        });\n    });\n\n\nYou can paste this code in your app (don't forget to add the cordova plugin too) or you could just install this package which does nothing more than the code above ;-)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftripflex%2Ffix-back-button-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftripflex%2Ffix-back-button-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftripflex%2Ffix-back-button-android/lists"}