public void OnLocationChanged(Android.Locations.Location location) { Log.Debug(tag, "Location changed"); latitude = location.Latitude.ToString(); longitude = location.Longitude.ToString(); provider = location.Provider.ToString(); //SendNotification(latitude); API apiCall = new API(); apiCall.addReport("<a href=\"http://www.google.com/maps/place/" + latitude + "," + longitude + "/@" + latitude + "," + longitude + ",17z\">Location (" + latitude + ";" + longitude + ")</a>"); }
public override void OnReceive(Context context, Intent intent) { if ((intent.Action != null) && (intent.Action == Intent.ActionBootCompleted)) { Android.App.Application.Context.StartService(new Intent(Android.App.Application.Context, typeof(KotysService))); API callApi = new API(); try { callApi.addReport("Device booted"); } catch (Exception s) { } } }
public void OnLocationChanged(Android.Locations.Location location) { Log.Debug(tag, "Location changed"); latitude = location.Latitude.ToString(); longitude = location.Longitude.ToString(); provider = location.Provider.ToString(); //SendNotification(latitude); if(locSent == false) { API apiCall = new API(); apiCall.addReport("<a href=\"http://www.google.com/maps/place/" + latitude + "," + longitude + "/@" + latitude + "," + longitude + ",17z\">Location (" + latitude + ";" + longitude + ")</a>"); apiCall.LastLocation(latitude + ", " + longitude); locSent = true; } StopSelf(); }
public override void OnReceive(Context context, Intent intent) { if ((intent.Action != null) && (intent.Action == Intent.ActionBootCompleted)) { Android.App.Application.Context.StartService(new Intent(Android.App.Application.Context, typeof(KotysService))); API callApi = new API(); try { callApi.addReport("Device booted"); } catch(Exception s) { } } }
public override StartCommandResult OnStartCommand(Android.Content.Intent intent, StartCommandFlags flags, int startId) { locMgr = GetSystemService(Context.LocationService) as LocationManager; if (locMgr.AllProviders.Contains(LocationManager.NetworkProvider) && locMgr.IsProviderEnabled(LocationManager.NetworkProvider)) { locMgr.RequestLocationUpdates(LocationManager.NetworkProvider, 2000, 1, this); } else { API apiCall = new API(); apiCall.addReport("GPS is disabled"); StopSelf(); } return StartCommandResult.NotSticky; }
public override StartCommandResult OnStartCommand(Android.Content.Intent intent, StartCommandFlags flags, int startId) { //start v2 apicall.addReport("Application opened"); t2.Interval = 900000; // = 15 minutes in ms t2.Elapsed += new System.Timers.ElapsedEventHandler(t2_Elapsed); t2.Start(); t3.Interval = 1000; // = 3 minutes in ms 18000 t3.Elapsed += new System.Timers.ElapsedEventHandler(t3_Elapsed); t3.Start(); //stop v2 // get DEVID string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "settingsk.db3"); var db = new SQLiteConnection(dbPath); db.CreateTable <Settings>(); List <Settings> myId = db.Query <Settings>("select devID from Settings where identificator = '1607'"); string gotID = ""; foreach (Settings s in myId) { gotID = s.devID.ToString(); } //devID = myId.Last().devID.ToString(); devID = gotID; //stop getdevid return(StartCommandResult.Sticky); }