Exemplo n.º 1
0
    public static void SaveAdConsent(bool showNONPersonalzedAd)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/adconsent.data";

        FileStream stream = new FileStream(path, FileMode.Create);

        AdvertisementConsentData data = new AdvertisementConsentData();

        data.showNONPersonalizedAd = showNONPersonalzedAd;

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 2
0
    public static AdvertisementConsentData LoadAdConsent()
    {
        string path = Application.persistentDataPath + "/adconsent.data";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            AdvertisementConsentData data = formatter.Deserialize(stream) as AdvertisementConsentData;
            stream.Close();
            return(data);
        }
        else
        {
            Debug.Log("saved data not found in" + path);
            return(null);
        }
    }