Blockstack is a platform for developing a new, decentralized internet, where users control and manage their own information. Interested developers can create applications for this new internet using the Blockstack platform.
This repository contains a pre-release for Android developers:
- the Blockstack Android SDK (
/blockstack-sdk
) - tools that assist development (
/tools
) - a tutorial that teaches you how to use the SDK
All of the material in this is a pre-release, if you encounter an issue please feel free to log it on this repository.
Use the detailed tutorial and to build your first Blockstack
Android application with React. You can also work through three example apps in
module (/example
),
(/example-multi-activity
) and (/example-service
).
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.blockstack:blockstack-android:$blockstack_sdk_version'
}
The current implementation of the Blockstack Android SDK uses the j2v8 engine and blockstack.js.
The example applications and tutorial uses a custom url scheme to handle the redirect from the sign-in process. In production, the redirect should be handled by app links such that no other apps could hijack the custom url scheme. (There is no security risk, it is just a bad user experience if an app chooser pops up and the user has to choose how to finish the sign-in.)
Replace the custom scheme intent filter with the intent filter with your domain/host name like this:
<activity android:name="./SignInActivity"
...>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="example.com" />
</intent-filter>
...
</activity>
Note, when using app links you do not need a web server anymore that redirects to the custom scheme.
All you need to host is a manifest.json
file for the app details and the assetlinks.json file for the app links.
The j2v8 engine requires that calls to the Blockstack session are made from only one thread.
The SDK comes with a default implementation of an Executor
that manages thread switching.
By default, network threads are done in the background, calls to the Blockstack session are done
on the main thread.
If the Blockstack session is not created on the main thread then a custom implementation of Excecutor
needs to be provided in the constructor of the Blockstack session. See the service example for some code.
It is also possible to manually switch threads buy using .releaseThreadLock
and .aquireThreadLock
.
These methods allow to make calls to the Blockstack session on a different thread. The thread lock
needs to be released on the current thread of the session. Then the new thread can aquire the thread lock.
Please see generated documenatation on the project's circle CI.
Please see the contribution guidelines.
Please see license file