New Files Custom blocks for sketchware

 After the release of android 10 and above versions, apps made with sketchware stop working on further versions if they require storage permission. In some cases apps crashes and in some crashes apps can't work properly without storage permission. So to fix this problem for storage access in sketchware , I found a working library and also it's blocks are provided to you in the bottom of this post.



In this post i will tell you the method how to use new storage custom blocks in sketchware.


View area

There are no special custom views for this library.


Logic area
So here comes the main part
OnCreate
Here use a default sketchware write file blocks with empty values as shown in picture.


This was just to get storage permission and then your'e ready to go.

Initialize Block
This block is used to initialise the function and this is just to tell the activity that we are going to perform any file action.

Remember this thing - Whenever you use other files blocks, always use this block before them. 
 

There are many types of paths where you can initialise that block but for now use external storage directory if you don't know what you need to do. 



There are Boolean blocks which can be used to determine if you can write a file or not. 

Also to check if your file exist or not.

And to check if a directory exist or not.



Create folder block
This can be used to create a new folder and the Boolean is to determine if we are going to override it or not. 

You can use true or false block inside it.


Create file block
This is used to create a new file and the second part of this block is used to set the content of that file. 




It can store a data or any other type of string variable in your file storage. You can modify this anytime this is by default in overwriting mode.




Read from file block
This is used to read a string file from any file path this can show its value to a text view or you can set it to a ring variable.


Path block

This is the value of a string with you set to the initialise block so that you do not need to type it again and again you can use the same value and it will get by itself.



Copy from to block

This is you to copy any type of file with an extension to a desired path from any other path. There are no limitation for the use of which block because you can use any type of image audio or text file or any other type of file with this block. This is easy to use and you can also replace the same file on the same path with any new extension.


Move from to block

To move any type of file from one path to another path and this is same as copy block but the only difference occur when it delete the file from original path.


Delete block

This is used to delete any type of tile with any extension from the desire path. 



Demo project
I am providing a demo project available on sketchub and you can download it and install and you can import that files block and you can add the local library the named storage and that's all.


 Local library
This is an implementation of library available for Android studio and it is imported to sketchware by me and your name to import that local library I will provide the link to that file in description.




I think I have cleared all your doubts and if you are getting problem or error in running that project you can contact us or contact in telegram group and you will get suggestion.

Comments

Popular posts from this blog

How to import local library in sketchware

Android 10/11 Storage Permission sketchware | New blocks + method

All Sketchware Pro Errors Solution

How to show one time message/dialog in sketchware

what is sketchware and history of sketchware

how to import export custom blocks sketchware

Create HTML Dialog in Sketchware

Sketchware Generate Firebase Dynamic Link (Long Url To Short) | sketchware blocks explained

Import java files in sketchware | How to add java files in sketchware | Basics of sketchware

How To make cool progressbar in sketchware | new block sketchware pro | sketchware pro tutorial