|
@ -12,8 +12,8 @@ This tutorial is written for readers who are new to either or both Blockstack |
|
|
and Android to create a decentralized application. It contains the following |
|
|
and Android to create a decentralized application. It contains the following |
|
|
content: |
|
|
content: |
|
|
|
|
|
|
|
|
- TOC |
|
|
TOC |
|
|
{:toc} |
|
|
{:toc} |
|
|
|
|
|
|
|
|
This tutorial was extensively tested using Android Studio 3.6 on a Dell XPS 13 |
|
|
This tutorial was extensively tested using Android Studio 3.6 on a Dell XPS 13 |
|
|
running Ubuntu 19. If your environment is different, you may encounter |
|
|
running Ubuntu 19. If your environment is different, you may encounter |
|
@ -508,25 +508,24 @@ Now that you have created your initial project and verified it running in an emu |
|
|
|
|
|
|
|
|
```kotlin |
|
|
```kotlin |
|
|
package blockstack.id.user.hello |
|
|
package blockstack.id.user.hello |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Intent |
|
|
import android.content.Intent |
|
|
import android.os.Bundle |
|
|
import android.os.Bundle |
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
import androidx.lifecycle.lifecycleScope |
|
|
import androidx.lifecycle.lifecycleScope |
|
|
import kotlinx.android.synthetic.main.activity_main.\* |
|
|
import kotlinx.android.synthetic.main.activity_main.\* |
|
|
import kotlinx.coroutines.Dispatchers |
|
|
import kotlinx.coroutines.Dispatchers |
|
|
import kotlinx.coroutines.launch |
|
|
import kotlinx.coroutines.launch |
|
|
import org.blockstack.android.sdk.BlockstackSession |
|
|
import org.blockstack.android.sdk.BlockstackSession |
|
|
import org.blockstack.android.sdk.BlockstackSignIn |
|
|
import org.blockstack.android.sdk.BlockstackSignIn |
|
|
import org.blockstack.android.sdk.SessionStore |
|
|
import org.blockstack.android.sdk.SessionStore |
|
|
import org.blockstack.android.sdk.getBlockstackSharedPreferences |
|
|
import org.blockstack.android.sdk.getBlockstackSharedPreferences |
|
|
import org.blockstack.android.sdk.model.UserData |
|
|
import org.blockstack.android.sdk.model.UserData |
|
|
import org.blockstack.android.sdk.model.toBlockstackConfig |
|
|
import org.blockstack.android.sdk.model.toBlockstackConfig |
|
|
import org.blockstack.android.sdk.ui.SignInProvider |
|
|
import org.blockstack.android.sdk.ui.SignInProvider |
|
|
import org.blockstack.android.sdk.ui.showBlockstackConnect |
|
|
import org.blockstack.android.sdk.ui.showBlockstackConnect |
|
|
|
|
|
|
|
|
class MainActivity : AppCompatActivity(), SignInProvider { |
|
|
class MainActivity : AppCompatActivity(), SignInProvider { |
|
|
|
|
|
|
|
|
private lateinit var blockstackSession: BlockstackSession |
|
|
private lateinit var blockstackSession: BlockstackSession |
|
|
private lateinit var blockstackSignIn: BlockstackSignIn |
|
|
private lateinit var blockstackSignIn: BlockstackSignIn |
|
@ -577,9 +576,8 @@ class MainActivity : AppCompatActivity(), SignInProvider { |
|
|
return blockstackSignIn |
|
|
return blockstackSignIn |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
### Run the final app in the emulator |
|
|
### Run the final app in the emulator |
|
|
|
|
|
|
|
@ -591,7 +589,7 @@ class MainActivity : AppCompatActivity(), SignInProvider { |
|
|
 |
|
|
 |
|
|
|
|
|
|
|
|
5. Select **Get Started** |
|
|
5. Select **Get Started** |
|
|
The system might prompt you how to select a browser. |
|
|
The system might prompt you how to select a browser. |
|
|
|
|
|
|
|
|
6. Work through the Blockstack prompts to login. |
|
|
6. Work through the Blockstack prompts to login. |
|
|
7. Blockstack redirects you to a web site. Open it with your Android app: Select **Hello Android** and **Always** |
|
|
7. Blockstack redirects you to a web site. Open it with your Android app: Select **Hello Android** and **Always** |
|
@ -607,4 +605,3 @@ The system might prompt you how to select a browser. |
|
|
Congratulations, you've completed your Android app using the Blockstack Android SDK. |
|
|
Congratulations, you've completed your Android app using the Blockstack Android SDK. |
|
|
|
|
|
|
|
|
Learn more about Blockstack by [trying another tutorial](https://blockstack.org/tutorials). |
|
|
Learn more about Blockstack by [trying another tutorial](https://blockstack.org/tutorials). |
|
|
``` |
|
|
|
|
|