FileTools : Some tools to work with files

I need to access a File.pdf with Start Activity. On my android 8.1 device I used the URI. file: ///sdcard/Makeroid/library/File.pdf. But on my other android 4.4 device it only worked with the URI. file: ///storage/Makeroid/library/File.pdf.
according to the device the uri will be started with sdcard or storage how can i identify this automatically?