# Android Freifunk-App ### First setting-up This is a set-up for macOS. First install Homebrew then install Node and Watchman using Homebrew `brew install node` `brew install watchman` Node comes with npm, which lets you install the React Native command line interface. `npm install -g react-native-cli` React Native requires a recent version of the Java SE Development Kit (JDK). Download and install JDK 8 or newer. Next download and install Android Studio Install the Android SDK Android Studio installs the latest Android SDK by default. Building a React Native app with native code, however, requires the Android 6.0 (Marshmallow) SDK in particular. Additional Android SDKs can be installed through the SDK Manager in Android Studio. Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the Android 6.0 (Marshmallow) entry, then make sure the following items are all checked: * Google APIs * Android SDK Platform 23 * Intel x86 Atom_64 System Image * Google APIs Intel x86 Atom_64 System Image Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that 23.0.1 is selected. Finally, click "Apply" to download and install the Android SDK and related build tools. The React Native tools require some environment variables to be set up in order to build apps with native code. Add the following lines to your $HOME/.bash_profile config file: `export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools` ### Running the Project To run the project, you have to navigate to the procject-folder. Then open a Android emulator and run on Terminal: `react-native run-android` ### Intalling React-Native-Android-Wifi React-Native-Android-Wifi is a react-native module for viewing and connecting to Wifi networks on Android devices. Adding to your Android Project `npm install react-native-android-wifi --save` Use react-native link to install native dependencies automatically: `react-native link` ### Building the apk. To build the apk please run: `react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res` . Then: `react-native run-android` This should provide you with a working apk at: android/app/build/outputs/apk Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.