Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document localhost development #98

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,46 @@ For an example of another Android app using the `utils` library, see the Vitabu
1. https://github.com/elimu-ai/vitabu/blob/main/build.gradle
1. https://github.com/elimu-ai/vitabu/blob/main/app/build.gradle

## Development 👩🏽‍💻

During development, you can choose between 3 build types:
1. `debug`
2. `qa_test`
3. `release`

By default, both `debug` and `qa_test` are pointing to a webapp
[test server](https://github.com/elimu-ai/webapp/blob/main/INSTALL.md#test-server). And if you want
to run the webapp yourself on `localhost` while testing the Content Provider app, you can change
the return value of the `getBaseUrl` method in
[BaseApplication.java](app/src/main/java/ai/elimu/content_provider/BaseApplication.java):
```java
// return url;
return "http://192.168.xxx.xxx:8080/webapp";
```

Use the `ifconfig` or `ipconfig` to get your IPv4 address.

You will also have to enable http connections by adding the following file to
`app/src/main/res/network_security_config.xml`:
```xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
```

And then adding it to [AndroidManifest.xml](app/src/main/AndroidManifest.xml):
```xml
<application
android:networkSecurityConfig="@xml/network_security_config"
```

After that, connect your Android device to the same Wi-Fi network as your computer, and run the app.

## Release 📦

See [.github/workflows/gradle-release.yml](.github/workflows/gradle-release.yml)
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "ai.elimu.content_provider"
minSdkVersion 24
targetSdkVersion 33
versionCode 1002012
versionName "1.2.12-SNAPSHOT"
versionCode 1002013
versionName "1.2.13-SNAPSHOT"
setProperty("archivesBaseName", "${applicationId}-${versionCode}")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
Expand Down