In-App Update to latest version using Firebase only

In App Update Install latest APK version from Firebase storage by downloading new APK From the App itself and installs it just like PLAY STORE in-app update

More Block

Block name - Install
Variable - String - apk
Label - path


More block (install ,apk path string)
String PATH = Environment.getExternalStorageDirectory() + _apk;
    java.io.File file = new java.io.File(PATH);
    if(file.exists()) {
	        Intent intent = new Intent(Intent.ACTION_VIEW);
	        intent.setDataAndType(uriFromFile(getApplicationContext(), new java.io.File(PATH)), "application/vnd.android.package-archive");
	        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
	        try {
		            getApplicationContext().startActivity(intent);
		        } catch (ActivityNotFoundException e) {
		            e.printStackTrace();
		            Log.e("TAG", "Error in opening the file!");
		        }
	    }else{
	        Toast.makeText(getApplicationContext(),"installing",Toast.LENGTH_LONG).show();
	    }
}
Uri uriFromFile(Context context, java.io.File file) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
	        return androidx.core.content.FileProvider.getUriForFile(context,context.getApplicationContext().getPackageName() + ".provider", file); 
	    } else {
	        return Uri.fromFile(file);
	    }

Provider

Edit the 'com.jajapp.dreamplay' with your app package name

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.jajapp.dreamplay.provider"
android:exported="false"
android:grantUriPermissions="true">

<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

Provider paths xml

Edit the 'com.jajapp.dreamplay' with your app package name

Add following code to Resources > xml/provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path
        name="files_root"
        path="Android/data/com.jajapp.dreamplay" />
    <external-path
        name="external_files"
        path="." />
</paths>