How to check if an app is installed in device

Is there a way to check if an app is installed in device(using my app made in thunkable of course)?

You may have a device variable, this variable defaults to null, when turned on, determine whether this variable is null, if so, set it to true, and use firebase to record.

If you have play store you can detect how many people have installed.

My question is: how to check if any app is installed on device. Your answer is applicable for checking to see if my app is installed.