public void checkchange()
        {
            while (true)
            {
                IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
                foreach (IPAddress ip in localIPs)
                {
                    if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        if (ipadre != ip.ToString())
                        {
                            servidor.Stop();
                            ipadre = ip.ToString();



                            servidor = new MultitubeWebServer(Android.OS.Environment.ExternalStorageDirectory.ToString(), 12345, ipadre, this);
                            var brandom = new Random();

                            Intent internado2                 = new Intent(this, typeof(serviciointerpreter23));
                            Intent internado3                 = new Intent(this, typeof(serviciointerpreter234));
                            var    pendingIntent3             = PendingIntent.GetService(ApplicationContext, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), internado3, 0);
                            var    pendingIntent2             = PendingIntent.GetService(ApplicationContext, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), internado2, 0);
                            Notification.Action       accion  = new Notification.Action(Resource.Drawable.drwaable, "Parar", pendingIntent2);
                            Notification.Action       accion2 = new Notification.Action(Resource.Drawable.drwaable, "Conectarse", pendingIntent3);
                            Notification.BigTextStyle textoo  = new Notification.BigTextStyle();
                            textoo.SetBigContentTitle("Stremeando en " + ipadre + ":12345");
                            textoo.SetSummaryText("Toque para parar de stremear su media");
                            textoo.BigText("Para conectarse introduzca " + ipadre + ":12345  " + "en su navegador o entre a multitubeweb.tk y toque conectar luego escanee el codigo que aparece al presionar el boton de + en multitubeweb.   al tocar parar se cierrar el servicio de streaming");


#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                            Notification.Builder nBuilder = new Notification.Builder(this);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                            nBuilder.SetContentTitle("Stremeando en " + ipadre + ":12345");
                            nBuilder.SetContentText("Toque para parar de stremear su media");
                            nBuilder.SetStyle(textoo);
                            nBuilder.SetColor(Android.Graphics.Color.DarkRed.ToArgb());
                            nBuilder.SetOngoing(true);
                            //   nBuilder.SetContentIntent(pendingIntent2);
                            nBuilder.SetSmallIcon(Resource.Drawable.antena);
                            nBuilder.AddAction(accion);
                            nBuilder.AddAction(accion2);
                            Notification notification = nBuilder.Build();
                            StartForeground(193423456, notification);



                            if (CheckInternetConnection() && Constants.UseFirebase)
                            {
                                meterdata();
                            }
                        }
                    }
                }
                MultiHelper.ExecuteGarbageCollection();
                Thread.Sleep(5000);
            }
        }
        public override void OnCreate()
        {
            instancia = this;
            IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
            foreach (IPAddress ip in localIPs)
            {
                if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    ipadre = ip.ToString();
                }
            }



            new Thread(() =>
            {
                if (CheckInternetConnection())
                {
                    bool notienenada = false;

                    WebClient cliente = new WebClient();
                    cliente.DownloadDataAsync(new Uri("https://raw.githubusercontent.com/Gr3gorywolf/Multitube.android/master/Updates/version.gr3v"));
                    cliente.DownloadDataCompleted += (aaa, aaaa) =>
                    {
                        string versionsinparsear = Encoding.UTF8.GetString(aaaa.Result);
                        if (!File.Exists(Android.OS.Environment.ExternalStorageDirectory.ToString() + "/.gr3cache/version.gr3v"))
                        {
                            notienenada = true;
                        }
                        if (notienenada)
                        {
                            MultitubeWebHelper.UpdateMultitubeWeb(versionsinparsear);
                        }
                        else
                        {
                            if (versionsinparsear != File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.ToString() + "/.gr3cache/version.gr3v"))
                            {
                                MultitubeWebHelper.UpdateMultitubeWeb(versionsinparsear);
                            }
                        }
                    };
                    if (Constants.UseFirebase)
                    {
                        meterdata();
                    }
                }
                else
                {
                }
            }).Start();
            if (servidor != null)
            {
                servidor.Stop();
            }

            servidor = new MultitubeWebServer(Android.OS.Environment.ExternalStorageDirectory.ToString(), 12345, ipadre, this);
            var pelo = new Thread(() =>
            {
                checkchange();
            });

            pelo.IsBackground = true;
            pelo.Start();



            var brandom = new Random();

            Intent internado2     = new Intent(this, typeof(serviciointerpreter23));
            Intent internado3     = new Intent(this, typeof(serviciointerpreter234));
            var    pendingIntent3 = PendingIntent.GetService(ApplicationContext, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), internado3, 0);
            var    pendingIntent2 = PendingIntent.GetService(ApplicationContext, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), internado2, 0);

            Notification.Action accion  = new Notification.Action(Resource.Drawable.drwaable, "Parar", pendingIntent2);
            Notification.Action accion2 = new Notification.Action(Resource.Drawable.drwaable, "Conectarse", pendingIntent3);

            Notification.BigTextStyle textoo = new Notification.BigTextStyle();
            textoo.SetBigContentTitle("Stremeando en " + ipadre + ":12345");
            textoo.SetSummaryText("Toque para parar de stremear su media");
            textoo.BigText("Para conectarse introduzca " + ipadre + ":12345  " + "en su navegador o entre a multitubeweb.tk y toque conectar luego escanee el codigo que aparece al presionar el boton de + en multitubeweb.   al tocar parar se cierrar el servicio de streaming");


#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            Notification.Builder nBuilder = new Notification.Builder(this);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            nBuilder.SetContentTitle("Stremeando en " + ipadre + ":12345");
            nBuilder.SetContentText("Toque para parar de stremear su media");

            nBuilder.SetOngoing(true);
            //  nBuilder.SetContentIntent(pendingIntent2);
            nBuilder.SetStyle(textoo);
            nBuilder.SetSmallIcon(Resource.Drawable.antena);
            nBuilder.SetColor(Android.Graphics.Color.ParseColor("#ce2c2b"));
            nBuilder.AddAction(accion);
            nBuilder.AddAction(accion2);

            Notification notification = nBuilder.Build();
            StartForeground(193423456, notification);
            base.OnCreate();
            //  descargar(intent.GetStringExtra("path"), intent.GetStringExtra("archivo"), intent.GetStringExtra("titulo"), intent.GetStringExtra("link"));
        }