|
| 1 | +# Preview Kolibri on a mobile device |
| 2 | + |
| 3 | +_Note: This guide focuses on Kolibri as a web app rather than the Android version of Kolibri._ |
| 4 | + |
| 5 | +Some tasks may require either an actual or simulated mobile device, such as a phone or tablet. |
| 6 | + |
| 7 | +## Browser development tools |
| 8 | + |
| 9 | +Most browsers provide ways to simulate mobile devices via their development tools. These tools are generally useful for testing: |
| 10 | + |
| 11 | +- Mobile viewports |
| 12 | +- Network and CPU throttling |
| 13 | +- Touch gestures |
| 14 | + |
| 15 | +Find specific guidance for the browser you are using. |
| 16 | + |
| 17 | +## Real mobile device |
| 18 | + |
| 19 | +Since browser development tools only offer an approximation, some tasks may require you to preview Kolibri on a real mobile device. |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +**Ensure that the mobile device you wish to use for previewing Kolibri is connected to the same local network as your computer where you run the development server.** |
| 24 | + |
| 25 | +### Option 1 (recommended) |
| 26 | + |
| 27 | +1. Run the development server with `yarn python-devserver` and `yarn run watch --write-to-disk` |
| 28 | +2. Find your computer's IP address |
| 29 | +3. Open a browser on the mobile device and navigate to your computer's IP address with port `:8000`, `http://x.x.x.x:8000`. There, you should see Kolibri. |
| 30 | + |
| 31 | +.. tip:: |
| 32 | + In ` yarn run watch --write-to-disk` command terminal output, you can find your computer's IP address on the line `[webpack-dev-server] On Your Network (IPv4): http://x.x.x.x:3000/`. |
| 33 | + |
| 34 | +### Option 2 |
| 35 | + |
| 36 | +1. Run the development server with `yarn python-devserver` and `yarn build` |
| 37 | +2. Find your computer's IP address |
| 38 | +3. Open a browser on the mobile device and navigate to your computer's IP address with port `:8000`, `http://x.x.x.x:8000`. There, you should see Kolibri. |
| 39 | + |
| 40 | +.. warning:: |
| 41 | + When running the development server as described above, you will need to rebuild frontend assets manually using `yarn build` after every change. |
| 42 | + |
| 43 | +.. tip:: |
| 44 | + Rebuild frontend assets faster by rebuilding only assets related to a plugin where you currently work. For example when developing on files of the Learn plugin, after the initial `yarn build` run, for all subsequent rebuilds only run `yarn exec kolibri-tools build prod -- --plugins kolibri.plugins.learn` instead of `yarn build`. Use `kolibri plugin list` to see all plugins. |
| 45 | + |
| 46 | +### Troubleshooting |
| 47 | + |
| 48 | +- If you see an indefinite Kolibri loader on your mobile device, double-check that you are not running the development server with `yarn development-hot`. Follow the steps outlined above instead. |
| 49 | + |
| 50 | +- If you cannot access Kolibri at all, check your firewall, VPN, or similar network settings. |
0 commit comments