diff --git a/Android/BlunoBasicDemo/.idea/caches/build_file_checksums.ser b/Android/BlunoBasicDemo/.idea/caches/build_file_checksums.ser
new file mode 100644
index 0000000..ce2fd99
Binary files /dev/null and b/Android/BlunoBasicDemo/.idea/caches/build_file_checksums.ser differ
diff --git a/Android/BlunoBasicDemo/.idea/caches/gradle_models.ser b/Android/BlunoBasicDemo/.idea/caches/gradle_models.ser
new file mode 100644
index 0000000..774a26f
Binary files /dev/null and b/Android/BlunoBasicDemo/.idea/caches/gradle_models.ser differ
diff --git a/Android/BlunoBasicDemo/.idea/codeStyles/Project.xml b/Android/BlunoBasicDemo/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/Android/BlunoBasicDemo/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Android/BlunoBasicDemo/.idea/gradle.xml b/Android/BlunoBasicDemo/.idea/gradle.xml
index 39139a6..9d9baf8 100644
--- a/Android/BlunoBasicDemo/.idea/gradle.xml
+++ b/Android/BlunoBasicDemo/.idea/gradle.xml
@@ -3,6 +3,9 @@
+
diff --git a/Android/BlunoBasicDemo/.idea/misc.xml b/Android/BlunoBasicDemo/.idea/misc.xml
index 8e2533e..a98dac1 100644
--- a/Android/BlunoBasicDemo/.idea/misc.xml
+++ b/Android/BlunoBasicDemo/.idea/misc.xml
@@ -1,43 +1,41 @@
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/Android/BlunoBasicDemo/.idea/modules.xml b/Android/BlunoBasicDemo/.idea/modules.xml
index 130956c..dc8a49d 100644
--- a/Android/BlunoBasicDemo/.idea/modules.xml
+++ b/Android/BlunoBasicDemo/.idea/modules.xml
@@ -3,6 +3,8 @@
+
+
diff --git a/Android/BlunoBasicDemo/.idea/vcs.xml b/Android/BlunoBasicDemo/.idea/vcs.xml
index 6564d52..b2bdec2 100644
--- a/Android/BlunoBasicDemo/.idea/vcs.xml
+++ b/Android/BlunoBasicDemo/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/Android/BlunoBasicDemo/app/build.gradle b/Android/BlunoBasicDemo/app/build.gradle
index 3c0c393..660aa2b 100644
--- a/Android/BlunoBasicDemo/app/build.gradle
+++ b/Android/BlunoBasicDemo/app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ compileSdkVersion 26
+ buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.dfrobot.angelo.blunobasicdemo"
- minSdkVersion 18
- targetSdkVersion 21
+ minSdkVersion 26
+ targetSdkVersion 26
versionCode 1
versionName "1.0"
}
@@ -22,5 +22,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:21.0.3'
+ compile 'com.android.support:appcompat-v7:26.1.0'
}
diff --git a/Android/BlunoBasicDemo/app/src/main/AndroidManifest.xml b/Android/BlunoBasicDemo/app/src/main/AndroidManifest.xml
index 8732f8c..e3f4d91 100644
--- a/Android/BlunoBasicDemo/app/src/main/AndroidManifest.xml
+++ b/Android/BlunoBasicDemo/app/src/main/AndroidManifest.xml
@@ -8,7 +8,8 @@ devices only. If you want to make your app available to devices that don't supp
you should omit this in the manifest. Instead, determine BLE capability by using
PackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->
-
+
+
diff --git a/Android/BlunoBasicDemo/app/src/main/java/com/dfrobot/angelo/blunobasicdemo/MainActivity.java b/Android/BlunoBasicDemo/app/src/main/java/com/dfrobot/angelo/blunobasicdemo/MainActivity.java
index 1ed3858..f47b2b4 100644
--- a/Android/BlunoBasicDemo/app/src/main/java/com/dfrobot/angelo/blunobasicdemo/MainActivity.java
+++ b/Android/BlunoBasicDemo/app/src/main/java/com/dfrobot/angelo/blunobasicdemo/MainActivity.java
@@ -1,14 +1,20 @@
package com.dfrobot.angelo.blunobasicdemo;
+import android.Manifest;
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.os.Bundle;
import android.content.Intent;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
+import android.widget.Toast;
public class MainActivity extends BlunoLibrary {
private Button buttonScan;
@@ -21,9 +27,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
onCreateProcess(); //onCreate Process by BlunoLibrary
-
-
- serialBegin(115200); //set the Uart Baudrate on BLE chip to 115200
+ requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 1);
+ serialBegin(115200); //set the Uart Baudrate on BLE chip to 115200
serialReceivedText=(TextView) findViewById(R.id.serialReveicedText); //initial the EditText of the received data
serialSendText=(EditText) findViewById(R.id.serialSendText); //initial the EditText of the sending data
@@ -45,8 +50,21 @@ public void onClick(View v) {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
-
- buttonScanOnClickProcess(); //Alert Dialog for selecting the BLE device
+ int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION);
+ if (permissionCheck != PackageManager.PERMISSION_GRANTED){
+ boolean requestCheck = ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION);
+ if (requestCheck){
+ requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 1);
+ }else {
+ new AlertDialog.Builder(MainActivity.this)
+ .setTitle("Permission Required")
+ .setMessage("Please enable location permission to use this application.")
+ .setNeutralButton("I Understand", null)
+ .show();
+ }
+ }else {
+ buttonScanOnClickProcess(); //Alert Dialog for selecting the BLE device
+ }
}
});
}
diff --git a/Android/BlunoBasicDemo/app/src/main/res/layout/activity_main.xml b/Android/BlunoBasicDemo/app/src/main/res/layout/activity_main.xml
index 9576a17..3bcc135 100644
--- a/Android/BlunoBasicDemo/app/src/main/res/layout/activity_main.xml
+++ b/Android/BlunoBasicDemo/app/src/main/res/layout/activity_main.xml
@@ -21,7 +21,7 @@