Skip to content

Unofficial Moralis native Android SDK (Proof of concept, work in progress)

License

Notifications You must be signed in to change notification settings

mobilekosmos/moralis-sdk-android

Repository files navigation

CI Known Vulnerabilities codecov android min api

Repository archived, new development will occur here https://github.com/Blocklin/blockchain-kotlin-sdk/

Moralis Build Serverless web3 apps

Moralis Kotlin SDK for Android (Unofficial)

An unofficial library that gives you access to the powerful Moralis Server backend from your native Android app.

For more information on Moralis and its features, see the website or the documentation.

This library is not related to the Moralis team and thus not maintained by them.

Motivation

Kotlin is the Android native language by excellence and the only one that allows to achieve the best app quality possible, nor Flutter, React Native, Ionic, etc. can provide comparable performance, memory and space consumption, availability of native APIs and overall stability. Furthermore Kotlin will provide cross plattform capabilities in the near future, thus the odds of Kotlin being the language by excellence for native cross plattform development are very good.

Getting Started

  1. Add the SDK: The easiest way to integrate the Moralis SDK into your Android project is through adding the dependency to your buid.gradle file: implementation 'com.github.mobilekosmos:moralis-sdk-android:<Tag>' where '< Tag >' is the latest released version on Github, please check. You can also use "master-SNAPSHOT" but this is not recommended, as the master is not approved for production.

  2. Initialize the SDK: The recommended place to initialize the SDK is in your application class to make sure the SDK is always started when the app starts. For this extend your application class from "MoralisApplication" and Call Moralis.start(APP_ID, SERVER_URL, applicationContext), like this:

    const val APP_ID = "xyz"
    const val SERVER_URL = "https://asdcyx.grandmoralis.com:2053/server"
    class App: MoralisApplication() {
        override fun onCreate() {
            super.onCreate()
            Moralis.start(APP_ID, SERVER_URL)
        }
    }
  1. Attach to the app's lifecycle: Call Moralis.onStart(this) and Moralis.onDestroy(this) in the respectives lifecycle callbacks.

  2. Attach to the Authentication events: Extend your authenticating Activity from Moralis.MoralisAuthenticationCallback

  3. Done, now you can call Moralis.authenticate() as per Moralis Docs or any Moralis function you want. Check the MainActivity class in the Sample to see a working example.

Note: the library automatically adds a line to the app's manifest: android:networkSecurityConfig="@xml/network_config" If your app is already setting this you must manually add the content of network_config.xml to your file. This is currently needed by the WalletConnect integration, but hopefully we can get rid of it in the final version.

Disclaimer

This is a proof of concept, not ready for production yet, work in progress.

⭐️ Star me: if you want this project to progress please star it, every star counts!

Find the TODO list here.

Sample

The sample includes a first draft of a working app that uses the native SDK showcasing a few functions.

Sample videos:

About

Unofficial Moralis native Android SDK (Proof of concept, work in progress)

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published