How to detect the Android version of the user device?

My game doesnt run well with android 4. I would like some kind of waring popup if the game detects that the device runs on android 4 or older. How do I do that?

The following SystemInfo function will return what you are looking for

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        print(SystemInfo.operatingSystem);
    }
}

SystemInfo is a class that will give you access to this information (via the operatingSystem variable). Or someone on a thread over at GameDev Stack Exchange has put up a small bit of C# that should return you the exact API level which you can then use to determine what android version is being run.

http://gamedev.stackexchange.com/questions/95342/is-there-a-way-to-check-android-version-running-the-game-using-unity3d

Hope this helps.