How to make to earn money when app is in background.

Hi,
I make clicker game on android and I need your help because I don’t know how to make to earn money when app is in background or phone is locked.

What you’ll have to do is to check the system clock, and upon Start, make it subtract the difference. You can store System.DateTime.Now somewhere like PlayerPrefs, and read it in in Start. Once you subtract the difference, you convert the DateTime object to a number (e.g. number of seconds), and then just used that number to advance your money counter.

The timespan class is good for this. And DateTime has a subtract method.
Something along these lines (I didn’t test this, it’s based off a time script I used in another app).
This assumes you are saving out a time to a playerpref as @StarManta suggested. We use a server time ourselves, but depending on your need will determine which is better for you.

        DateTime recordedTime = DateTime.Parse(PlayerPrefs.GetString("recordedTime"));
        DateTime currentTime = DateTime.Now;    
        int totalSecs = (int)currentTime.Subtract(recordedTime).TotalSeconds;