Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rdobrik/DfinityAndroidSample
Native Android Application calling the IC
https://github.com/rdobrik/DfinityAndroidSample
Last synced: 3 months ago
JSON representation
Native Android Application calling the IC
- Host: GitHub
- URL: https://github.com/rdobrik/DfinityAndroidSample
- Owner: rdobrik
- Created: 2021-11-05T03:23:50.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-05T04:01:29.000Z (about 3 years ago)
- Last Synced: 2024-06-21T18:10:46.126Z (5 months ago)
- Language: Kotlin
- Size: 47.9 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-icp - rdobrik/DfinityAndroidSample
README
# DfinityAndroidSample
# Android Native App connecting to the Internet ComputerNothing fancy, just HelloWorld native Android application calling query and update on the Internet Computer.
This application is using The Internet Computer Java Agent open source package
https://github.com/rdobrik/dfinity-agentThe code is in MainActivity.kt file, demonstrates how to create HTTP Transport, set arguments, call both query and update operations.
Canister Motoko code is in main.mo file, to test it just copy and paste to Motoko Playground and deploy it. Then use canister id and url in strings.xml, modify canister and values.
I tested this app on Android 8.1, so it should be compatible with any newer versions, probably older as well.
This app is using OkHttp client in ReplicaTransport, so we can exclude Apache 5 HTTP client. (Apache client transport version should work too, but it requires some additional modifications in the gradle build file)This is how you add Java Agent modules to your code (from Maven Central)
```
implementation 'commons-codec:commons-codec:1.15'
implementation('com.scaleton.dfinity:dfinity-agent:0.5.5') {
exclude group: 'org.apache.httpcomponents.client5', module: 'httpclient5'
}
```