Determine if Android app is being used for the first time

前端 未结 16 1124
攒了一身酷
攒了一身酷 2020-11-22 12:47

I am currently developing an android app. I need to do something when the app is launched for the first time, i.e. the code only runs on the first time the program is launch

16条回答
  •  名媛妹妹
    2020-11-22 13:31

    You could simply check for the existence of an empty file, if it doesn't exist, then execute your code and create the file.

    e.g.

    if(File.Exists("emptyfile"){
        //Your code here
        File.Create("emptyfile");
    }
    

提交回复
热议问题