How to view the content of an Encrypted Realm file using Sthetho-Realm

sthetho_Edited.png

Repository

https://github.com/facebook/stetho

What Will I Learn?

  • You will learn how to create Realm Objects from JSON file.
  • You will learn how to use RealmRecyclerViewAdapter.
  • You will learrn how to view Encrypted Realm file using sthetho-realm.

Requirements

System Requirements

  • An Integrated Development Environment(IDE) for building Android Application(e.g Android Studio, IntelliJ)
  • Android Device/Virtual Device.
  • Google Chrome browser installed (Windows/Mac).

Required Knowledge

  • Little Experience in working with Realm Java.
  • Java Programming Experience.
  • Little or no Experience working with Room
  • Of course, willingness to learn

Resources

Difficulty

  • Intermediate

Tutorial Content

Introduction

Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature natively part of the Chrome desktop browser.
source

In today's tutorial, we are going to learn how we can use sthetho-realm - a Realm module for Stetho to view an encrypted realm database file.

An encrypted realm as the name implies is a realm that is encrypted using a particular key (64byte key)

We develop an Android application that displays a list of Realm Objects and then we use the Sthetho-realm module to view the encrypted realm file stored on the android device.

The source code of this tutorial can be found here

Time Frame

  • Tutorial Introduction - 00:00 - 00:34
  • Dependencies Used - 00:37 - 02:46
  • Setting up Realm Database and custom RealmRecyclerViewAdapter - 02:48 - 07:49
  • Setting up our layout file - 07:50 - 09:35
  • Linking Everything together - 11:52 - 16:59
  • Viewing Encrypted Realm file using Sthetho in Google Chrome Browser - 17:00 - 18:58

Overview

  • Tutorial Introduction: In this part of the tutorial, an introduction to Stetho and Stetho realm is done.
  • Dependencies Used: In this part the used dependencies in the tutorial are being shown here, dependencies such as - butterknife (Used for view injection), Lombok library (Used for reduction of Boilerplate code), Realm(Used for storing realm objects), Realm Adapter(Used to create custom RealmRecyclerViewAdapter) Sthetho,
  • Setting up Realm Database and custom RealmRecyclerViewAdapter - In this session of the tutorial, we set up the Realm Database, creating the RealmObject class file (Countries.java), Creating a JSON file from which we will be populating our Realm Database from (countries.json), we then create our RealmRecyclerViewAdapter which is a custom RecyclerViewAdapter.
  • Setting up our layout file (activity_main.xml) : This part of the tutorial, we set up the main activity layout file where we add a TextView and then add a RecyclerView element and also create the sample layout file for each RecyclerView objects.
  • Linking Everything Together - In this part, we link all the earlier created components of the Application which includes creating an Application class file where we initialize our Realm for the application, set up our Stetho object indicating the encryption key and also the name of the encrypted Realm file, creating the Realm Objects from the JSON file, Initializing the RecyclerView and it's adapter.
  • Viewing Encrypted Realm file using Sthetho in Google Chrome Browser - Finally here, we used the Google Chrome Dev tools to view the content of our encrypted realm file.

Video Tutorial

Proof of Work

https://github.com/generalkolo/Realm-Examples/tree/master/Encrypted%20Realm

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center