Posts

Firebase Database Offline Capabilities | Android Studio | Kotlin

Image
Firebase Offline Capabilities for Firebase Database What if there is a temporary internet issue with your device? What if you don't want to load your database data again & again? Firebase easily allows you to achieve this task by persisting the data locally, managing presence and handling the latency. The data is available offline even if you restart the app or device. It will behave the same as you're online. Firebase keeps a queue of all write operations that are performed while your application is offline e.g. unstable internet connection. When your app becomes online all the queued write operations are sent to the Firebase Realtime Database Server. >>Check For Java Enabling Firebase Offline Persistence Once you enable the  Disk Persistence then the firebase handles the job automatically. You just need to add the following code snippet in your Application Class. MyApplication.java class MyApplication : Application() { override fun onCreate () { sup...

Firebase Database Offline Capabilities | Android Studio | Java

Image
Firebase Offline Capabilities for Firebase Database What if there is a temporary internet issue with your device? What if you don't want to load your database data again & again? Firebase easily allows you to achieve this task by persisting the data locally, managing presence and handling the latency. The data is available offline even if you restart the app or device. It will behave the same as you're online. Firebase keeps a queue of all write operations that are performed while your application is offline e.g. unstable internet connection. When your app becomes online all the queued write operations are sent to the Firebase Realtime Database Server. >>Check For Kotlin Enabling Firebase Offline Persistence Once you enable the  Disk Persistence then the firebase handles the job automatically. You just need to add the following code snippet in your Application Class. MyApplication.java public class MyApplication extends Application { @Override publi...

Send User Verification Email | Android Studio | Kotlin

Image
Firebase Email Verification:  Since any user can create an account in your firebase app whether this email exists in real or not so your app may need to verify that the email actually exists. You can easily send an email address verification email to a user with the   sendEmailVerification   method.  >>Check For Java Video Tutorial: Let's start: How to verify? private fun sendEmailVerification () { //get instance of firebase auth val firebaseAuth = FirebaseAuth.getInstance() //get current user val firebaseUser = firebaseAuth.currentUser //send email verification firebaseUser!!.sendEmailVerification() .addOnSuccessListener { Toast.makeText( this @ProfileActivity, "Instructions Sent..." , Toast.LENGTH_SHORT).show() } .addOnFailureListener { e -> Toast.makeText( this @ProfileActivity, "Failed to send due to " + e.message, Toa...

Send User Verification Email | Android Studio | Java

Image
Firebase Email Verification:  Since any user can create an account in your firebase app whether this email exists in real or not so your app may need to verify that the email actually exists. You can easily send an email address verification email to a user with the sendEmailVerification method.  >>Check For Kotlin Video Tutorial: Let's start: How to verify? private void sendEmailVerification () { FirebaseAuth firebaseAuth = FirebaseAuth . getInstance (); FirebaseUser firebaseUser = firebaseAuth . getCurrentUser (); firebaseUser . sendEmailVerification () . addOnSuccessListener ( new OnSuccessListener < Void >() { @Override public void onSuccess ( Void unused ) { Toast . makeText ( ProfileActivity . this , "Instructions Sent..." , Toast . LENGTH_SHORT ). show (); } }) . addOnFailure...

Shapeable ImageView | Android Studio | Java

Image
ShapeableImageView The ShapeableImageView is an ImageView that draws the bitmap with the provided Shape. For example, in your app, you may need an app with the shape of Circle, Rectangle, Rounded corners, Stroke/Border, etc. Using the ShapeableImageView you can easily draw images with any shape. >>Check For Kotlin Video Tutorial Code: styles.xml <?xml version="1.0" encoding="utf-8"?> <resources> <!--Adding styles to make different shapes for shapeable image view--> <style name= "ImageStyle_Circle" > <item name= "cornerSize" > 50% </item> <item name= "cornerFamily" > rounded </item> <!--possible values are rounded, cut--> </style> <style name= "ImageStyle_Corners_Rounded" > <item name= "cornerSize" > 20dp </item> <item name= "cornerFamily" > rounded <...

Shapeable ImageView | Android Studio | Kotlin

Image
ShapeableImageView The ShapeableImageView is an ImageView that draws the bitmap with the provided Shape. For example, in your app, you may need an app with the shape of Circle, Rectangle, Rounded corners, Stroke/Border, etc. Using the ShapeableImageView you can easily draw images with any shape. >>Check For Java Video Tutorial Code: styles.xml <?xml version="1.0" encoding="utf-8"?> <resources> <!--Adding styles to make different shapes for shapeable image view--> <style name= "ImageStyle_Circle" > <item name= "cornerSize" > 50% </item> <item name= "cornerFamily" > rounded </item> <!--possible values are rounded, cut--> </style> <style name= "ImageStyle_Corners_Rounded" > <item name= "cornerSize" > 20dp </item> <item name= "cornerFamily" > rounded </i...

startActivityForResult Depreciated Solution - Android Studio - Java

Image
How to use ActivityResult OR ActivityResultLauncher? Since the startActivityForResult() used to launce the intents like Gallery , Camera , File Pick , Share data , etc is deprecated so now there is a new way to do that ActivityResultLauncher class.  >> Check for Java >> Check for Kotlin >> Check for Compose Video Tutorial: Code: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "vertical" android:gravity= "center" tools:context= ".MainActivity" > <!--ImageView: set image after picking from gallery--> <ImageView android...