Posts

Manage External Storage Permission | Android Studio | Kotlin

Image
Manage External Storage Permission Previously (before Android 11) we only need to request the WRITE_EXTERNAL_STORAGE Permission to perform the storage-related tasks. But, now for Android 11 and above we have to request the MANAGE_EXTERNAL_STORAGE Permission to perform the storage-related tasks. Keep in mind that if you're 100% sure that your app requires this permission to work properly then request this permission otherwise Google will not allow you to publish/update your app. For example, if your app is WhatsApp Status Saver then you won't be allowed to use this permission as your app works with images and videos, not files. After permission is granted, I'll input a name and create a folder with that name just for example. You can do whatever you want instead. >>Check For Java Video Tutorial: Coding: AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/android"

Manage External Storage Permission | Android Studio | Java

Image
Manage External Storage Permission Previously (before Android 11) we only need to request the WRITE_EXTERNAL_STORAGE Permission to perform the storage-related tasks. But, now for Android 11 and above we have to request the MANAGE_EXTERNAL_STORAGE Permission to perform the storage-related tasks. Keep in mind that if you're 100% sure that your app requires this permission to work properly then request this permission otherwise Google will not allow you to publish/update your app. For example, if your app is WhatsApp Status Saver then you won't be allowed to use this permission as your app works with images and videos, not files. After permission is granted, I'll input a name and create a folder with that name just for example. You can do whatever you want instead. >>Check For Kotlin Video Tutorial: Coding: AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/android&qu

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

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

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 <