How can i Know when a file is being used or Opened in Google Drive folder.?

I am Integrating with Google drive using G_suite application scope and Drive activities. I Have to download the some files in specific folder. i have done this Downloading Process , but i wanted to throw an error if it is being used or opened. how can i do that can anyone help i this

Hi @pamu_rajesh ,

You can use google drive APIs in order to check if the file is already opened or not.
If API returns users in viewer or owner array then file is opened else file is not opened.
API Link :-