Hello Koders, today I will show you how to show a screen when opened app for 1st time, and show a different screen if it’s not 1st time opening the app. So, let’s get started
There are two methods to do it. These are: 1) TinyDB Method (Offline) and 2) Firebase Method (Online)
TinyDB method (Recommended)
This doesn’t require internet. It is easy and very fast. But it shows the 1stTimeScreen when the app’s data has been cleared or the app has been uninstalled.
Components needed
- TinyDB
- Components or Screens to show when 1st time and when not first time.
Here I’m using vertical arrangements to do it.
My components:
Here FirstTime
will be shown when the user opens the app for first time and NotFirstTime
will be shown when the user opens the app for not first time (2nd time, 3rd time …)
Blocks:
I hope the comments were clear and easy to understand
What to put in the empty spaces?
If you are using my idea, you can do this:
If you are using screens you can use this:
If Screen1 is your First Time screen you can do this:
@Ekansh_Pandit This is the solution of your problem.
Solution
Firebase method (Not Recommended)
This method is not recommended because it needs internet connection and it takes time and it’s hard. That’s why I’m not going to explain it by every detail. Though, it has also it’s own advantage, it can work even after the app is uninstalled. Here, I’ll be using Device Id to uniquely identify device.
Components: Firebase Database, Device Utilites, Layouts or Screens to show when 1st time and when not first time. (Here I’m using vertical arrangements to do it)
Setting up Firebase: Come here, scroll down untill you are at “Creating and Connecting our own Database to Firebase”. Do it until you are at Step 19
Blocks:
I have told before what to put in the empty space.
Firebase Result:
I showed the device ID because it’s an emulator
Others:
Downloads
Download and play with the blocks!
My App (TinyDB)
AIA: FirstTimeVisibleTinyDB.aia (2.3 KB)
AIS: FirstTimeVisibleTinyDB.ais (2.5 KB)
APK: FirstTimeVisibleTinyDB.apk (5.2 MB)
My App (Firebase) (Add your own ID, else it’ll not work)
AIA: FirstTimeVisibleFirebase.aia (2.7 KB)
AIS: FirstTimeVisibleFirebase.ais (2.9 KB)
Credits
Thanks to @Chirubot for this topic. I used it for firebase
Thanks to Kodular for being a part of my life
Notes
This guide will be updated with new things. The TinyDB is easy for most people, but the Firebase Database isn’t.
If you want to get solution of this type of problem like I gave to Eknash_Pandit, PM me and if I can, I will add your problem’s solution here too
I hope you like this guide. Thanks