Skip to content
Snippets Groups Projects
Commit 99fa1ac4 authored by raoul.dupuis's avatar raoul.dupuis
Browse files

add request location permission

parent 4c20d2dc
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.iot_hes.iotlab">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
......
// -*- mode: java -*-
package com.example.iot_hes.iotlab;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputFilter;
......@@ -68,6 +71,16 @@ public class MainActivity extends AppCompatActivity {
Log.d(TAG, "Version: "+VERSION);
if (ActivityCompat.checkSelfPermission(
this,
android.Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
2);
}
PositionText = findViewById(R.id.PositionText);
Percentage = findViewById(R.id.Percentage);
IncrButton = findViewById(R.id.IncrButton);
......@@ -79,17 +92,17 @@ public class MainActivity extends AppCompatActivity {
Flags.DISABLE_BATCH_SCANNING.set(true);
Flags.DISABLE_HARDWARE_FILTERING.set(true);
EstimoteSDK.initialize(getApplicationContext(), "", ""
EstimoteSDK.initialize(getApplicationContext(), //"", ""
// These are not needed for beacon ranging
// "smarthepia-8d8", // App ID
// "771bf09918ceab03d88d4937bdede558" // App Token
"smarthepia-8d8", // App ID
"771bf09918ceab03d88d4937bdede558" // App Token
);
EstimoteSDK.enableDebugLogging(true);
// we want to find all of our beacons on range, so no major/minor is
// specified. However the student's labo has assigned a given major
region = new BeaconRegion(TAG, UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"),
17644, // major -- for the students it should be the assigned one
null, // major -- for the students it should be the assigned one 17644
null // minor
);
beaconManager = new BeaconManager(this);
......
......@@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
......
#Mon Sep 07 15:44:07 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment