{"id":13537608,"url":"https://github.com/mmin18/AndroidDynamicLoader","last_synced_at":"2025-04-02T04:31:07.909Z","repository":{"id":64818163,"uuid":"5194068","full_name":"mmin18/AndroidDynamicLoader","owner":"mmin18","description":"A plugin system that runs like a browser, but instead of load web pages, it load apk plugins which runs natively on Android system.","archived":false,"fork":false,"pushed_at":"2016-02-19T08:11:23.000Z","size":4049,"stargazers_count":1475,"open_issues_count":5,"forks_count":495,"subscribers_count":138,"default_branch":"master","last_synced_at":"2025-03-25T18:18:07.047Z","etag":null,"topics":["android","fragments","plugin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmin18.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-26T15:53:24.000Z","updated_at":"2025-03-17T14:18:09.000Z","dependencies_parsed_at":"2022-12-15T11:19:02.068Z","dependency_job_id":null,"html_url":"https://github.com/mmin18/AndroidDynamicLoader","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/mmin18%2FAndroidDynamicLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmin18%2FAndroidDynamicLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmin18%2FAndroidDynamicLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmin18%2FAndroidDynamicLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmin18","download_url":"https://codeload.github.com/mmin18/AndroidDynamicLoader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246746935,"owners_count":20827061,"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","fragments","plugin"],"created_at":"2024-08-01T09:01:01.052Z","updated_at":"2025-04-02T04:31:07.863Z","avatar_url":"https://github.com/mmin18.png","language":"Java","funding_links":[],"categories":["Java","Index","Libs"],"sub_categories":["Android Plugin","\u003cA NAME=\"Framework\"\u003e\u003c/A\u003eFramework"],"readme":"# Android Dynamic Loader\n\nAndroid Dynamic Loader is a plugin system. The host application is like a browser, but instead of load web pages, it load plugins which runs natively on Android system.\n\nYou can download the demo from \u003chttps://github.com/mmin18/AndroidDynamicLoader/raw/master/host.apk\u003e (35k).\n\n![HelloWorldDemo](https://raw.github.com/mmin18/AndroidDynamicLoader/master/HelloWorldDemo.png)\n\n![BitmapFunDemo](https://raw.github.com/mmin18/AndroidDynamicLoader/master/BitmapFunDemo.png)\n\n## How to run the sample plugins\n\nThe sample plugins is under **workspace** folder, but do not try to run them directly, it won't start.\n\nFirst you need to install **host.apk** on your phone (or you can build the Host project yourself)\n\nAlso you need to make sure the Android SDK and Ant is installed and android-sdk/tools, android-sdk/platform-tools, ant is in your **PATH**.\n\nRun the following commands:\n\n\tchmod +x tools/update.sh\n\ttools/update.sh workspace\n\tcd workspace\n\tant run\n\nIf it shows \"device not found\", make sure your phone is connected or simulator is running. \"adb devices\" will tell.\n\nSince we don't specific a default entry in **workspace.properties**, it will popup a window and let you choose one. I suggest bitmapfun.\n\n## About UI Container\n\nIn a normal Android application, we use Activity as the root UI container. But since Activity is registered in AndroidManifest.xml, and we can't modify manifest in runtime, we must find an alternative UI container - Fragment.\n\nThe Fragment itself, introduced in Android 3.0 Honeycomb, is a perfect UI container, and it has lifecycle and state management.\n\nOnce the plugin and its dependency is downloaded, an Activity (MainActivity.java) will be started, create an instance of the specific fragment, and add the fragment into the root view.\n\nSee the [HelloFragment.java](https://github.com/mmin18/AndroidDynamicLoader/blob/master/workspace/sample.helloworld/src/sample/helloworld/HelloFragment.java) sample.\n\n## About URL Mapping\n\nSince we use Fragment as UI container, each page is implemented in Fragment instead of Activity. So how do we start a new page?\n\nWe use URL, just like a browser does. For instance, in a browser, we open `http://mydomain.com/helloworld.html`. In plugins, we open `app://helloworld`.\n\n\tIntent i = new Intent(Intent.ACTION_VIEW, Uri.parse(\"app://helloworld\"));\n\tstartActivity(i);\n\nEach host is mapped to a single fragment, you define the url mapping table in **project/fragment.properties**.\n\nSee the [helloworld fragment.properties](https://github.com/mmin18/AndroidDynamicLoader/blob/master/workspace/sample.helloworld/fragment.properties) sample.\n\n## About Resources\n\nIn the plugins, we pack resources and codes in the same package. We use R.java as the index of resources.\n\nBut instead of using **context.getResources()**, we use **MyResources.getResource(Me.class)** to get the resources which in the same package as **Me.class**.\n\nHere is a sample in HelloFragment.java\n\n\t@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\n\t\t// MyResources manages the resources in specific package.\n\t\t// Using a Class object to obtain an instance of MyResources.\n\n\t\t// In this case, hello.xml is in the same package as HelloFragment class\n\n\t\tMyResources res = MyResources.getResource(HelloFragment.class);\n\n\t\t// Using MyResources.inflate() if you want to inflate some layout in\n\t\t// this package.\n\t\treturn res.inflate(getActivity(), R.layout.hello, container, false);\n\n\t}\n\nYou can use MyResources to get drawable, string, or inflate layout.\n\n## Folders\n\n`/Host` contains the host application (build as host.apk).\n\n`/tools/update.sh` checks your environment and helps you config your plugins. You should always run it once after git clone or create a new plugin.\n\n`/workspace/sample.helloworld` is a most simple plugin.\n`/workspace/sample.helloworld/fragment.properties` defines the url mapping of your fragments.\n\n`/site/***/site.txt` is the definition file for all the plugins files, dependency and fragments url mapping table.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmin18%2FAndroidDynamicLoader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmin18%2FAndroidDynamicLoader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmin18%2FAndroidDynamicLoader/lists"}