- How It Works :
The user's GPS latitude should be between -22.899529 and -22.899922 to create a perimeter . The application will only work some functionality if it is within this perimeter
.
- Note :
1) I did not insert the longitude because I'm trying to make it enter this If, but I am very possible to show examples with longitude together.
- Shopping.java
package com.vuforia.samples.Books.app.Neoris; import android.app.Activity; import com.vuforia.Vuforia; import com.vuforia.samples.Books.ui.ActivityList.AboutScreen; /** * Created by th on 14/06/17. */ public class Shopping { private String nomeShopping; private String licenseKey; private String accessKey; private String secretKey; private Activity mActivity; private int mVuforiaFlags = 0; public Shopping(AboutScreen aboutScreen) { } public Shopping() { } public String getNome() { return nomeShopping; } public void setNome(String nome) { this.nomeShopping = nome; } public String getLicenseKey() { return licenseKey; } public void setLicenseKey(String licenseKey) { this.licenseKey = licenseKey; } public String getAccessKey() { return accessKey; } public void setAccessKey(String accessKey) { this.accessKey = accessKey; } public String getSecretKey() { return secretKey; } public void setSecretKey(String secretKey) { this.secretKey = secretKey; } public void setDados(double latitude, double longitude){ // -22.899529 -22.899922 // O menor é o MAIOR // o maior é o MENOR if((latitude >= -22.899529 && latitude <= -22.899922)){ setNome("Neoris"); setLicenseKey("Ad84Z0z/////AAAAGSgcOhPVvkoniWypHW2Dfsw+iX69sih5qx5JH1PEs92sM2xIhbsKnb2eTNkfBeQymsfgyRswpCDi2Ocu78RH+5+7/fXED7hJPLf3T7k4xKKLl4z8OKfCmr8jE0L5wQdJVV9L3tiHEoUx67M4b3ZSlO3/AzDLYi2/Zt3z8fuPo62osy469O+bKBsKKZtnyX9K7RYwJ2colMQ1bIhQERjg1w5cEZLHUacXAI1ndYhzS2Xl5iwAz98VZ65sptn+PrA5Xno55VGddt7rSBmvwuhZzeyShWnOqiYFhjWg80F3PFv2H/hYfIt4ML37yerJxS/n0z8yFv1H5gPi+Abd5nfaboz/xx1WgXf0yDvQKslFV+rr"); Vuforia.setInitParameters(mActivity, mVuforiaFlags, "" + getLicenseKey()); // Importante para o setLicenseKey. setAccessKey("f854427b00cf89cb4909cf3780a22f1fe6dd1daa"); setSecretKey("16208b50224e2ff8d3c93f069d2c4adf739cea7a"); } else if((latitude >= -22.899682) && (latitude <= -22.900006) && (longitude >= -43.178666) && (longitude <= -43.178197)){ setNome("Outros"); setLicenseKey("AULCxLD/////AAAAGa6JoRhAAk70lshljOUpGeN7XUgbJ/jA8ZGpdHb4EVUBTsJ5Z6C8FYvrRBtMsbePU6wI2DKgO3U7msQ9bMqY1+qn0SRY8K3raNYxd+cgBkbmiJDonnuvPr9Hd3RHo7ArwO1x8wGsA1sWw/Bo+q7HpjLbdKqM/ceI2IlnWJQTD+H47zlFuV63utnK/soPttLP+HmL1Lx/ko6uLLKe9yhuuAwpbkNR0UsNGYXlueTCOU/CfIot0VCBg2Kxpz4/cnlmCetedW0+bZypzh6gWfV9MS1Sh9n1LEYr8EXjpOEyHhaBPAgE3lX5khkVc3FRetD81WC7fRAQB5ozp6X1H4u04yWLbzWf8S8XSPK5a542gbNg"); Vuforia.setInitParameters(mActivity, mVuforiaFlags, "" + getLicenseKey()); // Importante para o setLicenseKey. setAccessKey("6ad29c13cb8af364c7c7f893ca7651974a887f96"); setSecretKey("370db33ce57acc73a84df1f6d19339da69e45235"); } } }
- AboutScreen.java [The code is not complete because you do not need it]:
latitude = gps.getLatitude(); longitude = gps.getLongitude(); /* * Melhora a precisão do Resultado encontrado pelo GPS * para (6) casas decimais com arredondamento. * */ BigDecimal precisaoLatitude = new BigDecimal(latitude); BigDecimal precisaoLongitude = new BigDecimal(longitude); precisaoLatitude = precisaoLatitude.setScale(6, RoundingMode.UP); precisaoLongitude = precisaoLongitude.setScale(6, RoundingMode.UP); latitude = Double.parseDouble(String.valueOf(precisaoLatitude)); longitude = Double.parseDouble(String.valueOf(precisaoLongitude));