Browse Source

Bug fixes

master
Apalak Dutta 1 year ago
parent
commit
1540c289c8
4 changed files with 19 additions and 9 deletions
  1. +3
    -1
      examples/example_bestshot/example/app/src/main/java/ru/Service/MyLocationService.java
  2. +6
    -0
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/constant/LatLong.java
  3. +1
    -0
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/constant/Url.java
  4. +9
    -8
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java

+ 3
- 1
examples/example_bestshot/example/app/src/main/java/ru/Service/MyLocationService.java View File

@ -60,7 +60,7 @@ public class MyLocationService extends Service {
private void trackGPS() { private void trackGPS() {
handler.postDelayed(runnable = new Runnable() { handler.postDelayed(runnable = new Runnable() {
public void run() { public void run() {
handler.postDelayed(runnable, delay);
System.out.println("Inside handler"); System.out.println("Inside handler");
/*Intent intent = new Intent(MainActivity.this,MyLocationService.class); /*Intent intent = new Intent(MainActivity.this,MyLocationService.class);
startService(intent);*/ startService(intent);*/
@ -75,6 +75,8 @@ public class MyLocationService extends Service {
} }
}, delay); }, delay);
handler.postDelayed(runnable, delay);
} }
@Override @Override


+ 6
- 0
examples/example_bestshot/example/app/src/main/java/ru/visionlab/constant/LatLong.java View File

@ -0,0 +1,6 @@
package ru.visionlab.constant;
public class LatLong {
public static final double newLat= 22.5118;
public static final double newLong= 88.4001;
}

+ 1
- 0
examples/example_bestshot/example/app/src/main/java/ru/visionlab/constant/Url.java View File

@ -3,4 +3,5 @@ package ru.visionlab.constant;
public class Url { public class Url {
public static final String Base_url= "https://reqres.in/api/"; public static final String Base_url= "https://reqres.in/api/";
} }

+ 9
- 8
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java View File

@ -36,6 +36,7 @@ import android.widget.Toast;
import cn.pedant.SweetAlert.SweetAlertDialog; import cn.pedant.SweetAlert.SweetAlertDialog;
import ru.Service.MyLocationService; import ru.Service.MyLocationService;
import ru.visionlab.constant.LatLong;
import ru.visionlab.femdemo.login.LoginActivity; import ru.visionlab.femdemo.login.LoginActivity;
import ru.visionlab.femdemo.register.RegisterActivityNew; import ru.visionlab.femdemo.register.RegisterActivityNew;
import ru.visionlab.femdemo.views.EmployeeActivity; import ru.visionlab.femdemo.views.EmployeeActivity;
@ -243,11 +244,10 @@ public class CheckInActivity extends AppCompatActivity {
double lat=LocationGps.getLatitude(); double lat=LocationGps.getLatitude();
double longi=LocationGps.getLongitude(); double longi=LocationGps.getLongitude();
double newLat = 22.5150;
double newLong = 88.3930;
float[] results = new float[1]; float[] results = new float[1];
Location.distanceBetween(lat,longi,newLat,newLong,results);
Location.distanceBetween(lat,longi,LatLong.newLat,LatLong.newLong,results);
distance = results[0]; distance = results[0];
Toast.makeText(this,String.valueOf(distance)+" metres from location",Toast.LENGTH_SHORT).show(); Toast.makeText(this,String.valueOf(distance)+" metres from location",Toast.LENGTH_SHORT).show();
if(distance > 400){ if(distance > 400){
@ -267,14 +267,10 @@ public class CheckInActivity extends AppCompatActivity {
double lat=LocationNetwork.getLatitude(); double lat=LocationNetwork.getLatitude();
double longi=LocationNetwork.getLongitude(); double longi=LocationNetwork.getLongitude();
double newLat = 22.5118;
double newLong = 88.4001;
/*double newLat = 22.5150;
double newLong = 88.3930; */
float[] results = new float[1]; float[] results = new float[1];
Location.distanceBetween(lat,longi,newLat,newLong,results);
Location.distanceBetween(lat,longi, LatLong.newLat,LatLong.newLong,results);
float distance = results[0]; float distance = results[0];
Toast.makeText(this,String.valueOf(distance)+" metres from location",Toast.LENGTH_LONG).show(); Toast.makeText(this,String.valueOf(distance)+" metres from location",Toast.LENGTH_LONG).show();
if(distance > 400){ if(distance > 400){
@ -396,5 +392,10 @@ public class CheckInActivity extends AppCompatActivity {
.show(); .show();
} }
@Override
public void onBackPressed () {
Toast.makeText(CheckInActivity.this,"Ongoing process . Please logout to go back.",Toast.LENGTH_LONG).show();
}
} }

Loading…
Cancel
Save