mobile

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2022 License: ISC Imports: 3 Imported by: 0

README

mobile

[Build Status] (https://travis-ci.org/gcash/bchwallet)

This package is intended to be used to run bchwallet on iOS and Android devices. It offers exported functions which start and stop the wallet that can be called from the language binding.

The following is an example of how to compile for Android:

  1. Make sure the android SDK is installed on your computer. If you use android studio you should already have it installed.

  2. Install NDK. You can find this in the Android SDK Manager inside Android Studio under SDK Tools.

  3. Set the ANDROID_HOME environmental variable and also put it in your path:

    export ANDROID_HOME=$HOME/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
    
  4. Initalize gomobile

    gomobile init -ndk=$HOME/Android/Sdk/ndk-bundle
    
  5. Build the language bindings. This generates a .aar file

    cd $GOPATH/src/github.com/gcash/bchwallet/mobile
    gomobile bind -target=android -o=bchwallet.aar
    
  6. Import the .aar file as a dependency in Android Studio. See this stack overflow answer for the steps of how to import import into your project.

  7. You can now start the wallet from the Java code.

    String configPath = getFilesDir() + "/bchwallet.conf";
    mobile.Mobile.StartWallet(configPath);
    
  8. The wallet is now running and you can use the gRPC API to control it.

  9. Use mobile.Mobile.StopWallet() to stop it and perform a clean shutdown.

Note that StartWallet takes in a path to a config file. You will need to programatically create and save the config file on the device. As you do this make sure to set the appdata and logdir to a valid path on the device. You will also most likely want to use the noinitialload config option and create the wallet using the API.

Finally you may run into this bug in gomobile which may require you to modify a python file in your Android SDK.

Package mobile is licensed under the copyfree ISC License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartWallet

func StartWallet(configPath string)

StartWallet is the function exposed to the mobile device to start the bchwallet. configPath is the path to the bchwallet.conf file that should be saved on your mobile device.

Make sure you save in the config file the correct path on the device to use for `appdata`. You will likely also want to the `noinitalload` option to prevent the wallet from blocking startup as it waits for input from stdin.

Once the wallet is started you will want to control it using the gRPC API. A `CreateWallet` RPC is available which you will need to call first.

func StopWallet

func StopWallet()

StopWallet will stop the wallet and perform a clean shutdown.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL