Exemple #1
0
        public void UpdateMarker()
        {
            DataTable dtlatlon = new DataTable();

            WebReference.BasicHttpBinding_IService1 MyClient = new WebReference.BasicHttpBinding_IService1();

            WebReference.TB latlon = new WebReference.TB();
            latlon = MyClient.GetLatLon(sharedPreferences.GetString("deviceid", null));

            dtlatlon = latlon.table;

            theMap.Clear();

            LatLng       latlng = new LatLng(System.Convert.ToDouble(dtlatlon.Rows[0][0].ToString()), System.Convert.ToDouble(dtlatlon.Rows[0][1].ToString()));
            CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, theMap.CameraPosition.Zoom);

            theMap.MoveCamera(camera);
            MarkerOptions options = new MarkerOptions().SetPosition(latlng).SetTitle("Last Update on " + dtlatlon.Rows[0][2].ToString());
            Marker        marker  = theMap.AddMarker(options);

            marker.ShowInfoWindow();
            if (this.PerformRuntimePermissionCheckForLocation(REQUEST_PERMISSIONS_LOCATION))
            {
                InitializeUiSettingsOnMap();
            }
        }
Exemple #2
0
        public void GetData()
        {
            DataTable dt = new DataTable();

            WebReference.BasicHttpBinding_IService1 MyClient = new WebReference.BasicHttpBinding_IService1();
            try
            {
                WebReference.TB emp      = new WebReference.TB();
                string          deviceid = Android.Provider.Settings.Secure.GetString(Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
                emp = MyClient.GetListDevice(deviceid);

                dt = emp.table;


                recyclelist.Clear();
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        recyclelist.Add(new GetSet(dt.Rows[i][0].ToString(), dt.Rows[i][1].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #3
0
            protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
            {
                WebReference.BasicHttpBinding_IService1 MyClient = new WebReference.BasicHttpBinding_IService1();
                try
                {
                    WebReference.TB emp      = new WebReference.TB();
                    string          deviceid = Android.Provider.Settings.Secure.GetString(Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
                    emp = MyClient.GetListDevice(deviceid);

                    dt = emp.table;


                    recyclelist.Clear();
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            recyclelist.Add(new GetSet(dt.Rows[i][0].ToString(), dt.Rows[i][1].ToString()));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Snackbar snackbar = Snackbar.Make(findViewById(Android.Resource.Id.Content), "Error Connection", Snackbar.LengthLong);
                    snackbar.Show();
                }
                return(null);
            }
Exemple #4
0
        void OnItemClick(object sender, int position)
        {
            DataTable dt = new DataTable();

            string parentdeviceid = recyclelist[position].getparentdeviceid();
            string userid         = recyclelist[position].getuserid();
            var    appid          = "AAAAIS9WtFE:APA91bF_EYn_n1l50-PUDfn9RIjZhj7TT4e_02aB15eKc-mlSCZCLU-Q7NQDFH21Wflg-rIQ1WNlZoIhT94hwxrAvLKAkFg6_KjF1Gv2UcIeJ94Q93HHJC9JMANbl5BUjpaFtXca0_yb";
            var    senderid       = "142528132177";

            WebReference.BasicHttpBinding_IService1 notif = new WebReference.BasicHttpBinding_IService1();

            WebReference.TB key = new WebReference.TB();
            key = notif.GetKeyFCM(parentdeviceid);

            dt = key.table;

            ISharedPreferencesEditor keyfcm = sharedPreferences.Edit();

            keyfcm.PutString("keyfcm", dt.Rows[0][0].ToString());
            keyfcm.PutString("deviceid", parentdeviceid);
            keyfcm.PutString("userid", userid);
            keyfcm.Commit();

            notif.PushNotification(appid, senderid, dt.Rows[0][0].ToString(), "start", userid);

            DataTable dtlatlon = new DataTable();

            WebReference.TB latlon = new WebReference.TB();
            latlon = notif.GetLatLon(parentdeviceid);

            dtlatlon = latlon.table;

            ISharedPreferencesEditor editor = sharedPreferences.Edit();

            editor.PutString("lat", dtlatlon.Rows[0][0].ToString());
            editor.PutString("lon", dtlatlon.Rows[0][1].ToString());
            editor.PutString("update", dtlatlon.Rows[0][2].ToString());
            editor.Commit();


            Intent ij = new Intent(this, typeof(MyLocationActivity));

            StartActivity(ij);
        }