1.4.2 • Published 4 years ago
ssas-app-core v1.4.2
SSAS App Core
App core contains React Native
code shared across apps that work in tandem with SSAS Core Portals.
Main Functionality
- 🔗 Domain selection.
- 👤 Facilitate/enforce user authentication.
- 📦 Connect to portal and download latest survey + survey assets.
- 📜 Integrates with SSAS Enketo v2.
- 📱Customizable UI to collect and upload surveys.
- 📡 Ability to check for updates from the app.
Usage
Note: App Core is designed to work with React Native v0.59+.
1. Create a new React Native project.
2. You must have these packages installed and linked:
{
"@react-native-community/async-storage": "^1.2.1",
"axios": "^0.18.0",
"native-base": "^2.3.10",
"react-native-fs": "^2.13.3",
"react-native-message-bar": "^2.0.10",
"react-native-vector-icons": "^6.4.2",
"react-native-webview": "^5.4.6",
"react-native-zip-archive": "^4.0.0",
"react-navigation": "^1.5.8",
}
Add this package as a dependency:
yarn add ssas-app-core
4. Link ssas-enketo
with your Android and iOS projects.
Android
# Creates symlink for Android.
# Run this in the root folder of your project.
cd android/app/src/main/assets
ln -s ../../../../../node_modules/ssas-enketo/www www
iOS
- Open your app's iOS project in XCode.
- Open your app's root directory in Finder and go to
node_modules/ssas-enketo
- Drag and drop www folder to your XCode project. (As a reference. Don't copy)
5. Integrating SSAS App Core with your React Native App
Android
First, make sure your android/app/src/main/AndroidManifest.xml
contains the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Optional: Enabling Debugging in Browser*
If you want to debug the Enketo installation in Browser, you must configure MainApplication.java
class appropriately.
// Append to the beginning
import android.webkit.WebView;
// Then go to the onCreate method, make sure it looks like this:
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
WebView.setWebContentsDebuggingEnabled(true);
}
Rest of the documentation: WIP