diff --git a/IDE/Android/.idea/gradle.xml b/IDE/Android/.idea/gradle.xml
index 526b4c25..a2d7c213 100644
--- a/IDE/Android/.idea/gradle.xml
+++ b/IDE/Android/.idea/gradle.xml
@@ -13,7 +13,6 @@
-
diff --git a/IDE/Android/.idea/misc.xml b/IDE/Android/.idea/misc.xml
index 860da66a..0c29bd6f 100644
--- a/IDE/Android/.idea/misc.xml
+++ b/IDE/Android/.idea/misc.xml
@@ -1,5 +1,12 @@
+
+
+
diff --git a/IDE/Android/README.md b/IDE/Android/README.md
index 37d5e786..9ce96573 100644
--- a/IDE/Android/README.md
+++ b/IDE/Android/README.md
@@ -6,11 +6,11 @@ project should be used for reference only.
Tool and version information used when testing this project:
- Ubuntu 20.04.3 LTS
-- Android Studio Bumblebeea 2021.1.1 Patch 3
+- Android Studio Chipmunk 2021.2.1
- Android Gradle Plugin Version: 4.2.2
- Gradle Version: 7.1.3
-- API 28: Android 9.0 (Pie)
-- Emulator: Nexus 5X API 28
+- API 30: Android 11
+- Emulator: Pixel 5 API 31
The following sections outline steps required to run this example on an
Android device or emulator.
diff --git a/IDE/Android/app/build.gradle b/IDE/Android/app/build.gradle
index e698f103..1cb39b4d 100644
--- a/IDE/Android/app/build.gradle
+++ b/IDE/Android/app/build.gradle
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 28
+ compileSdkVersion 30
defaultConfig {
applicationId "com.example.wolfssl"
- minSdkVersion 23
- targetSdkVersion 28
+ minSdkVersion 30
+ targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
diff --git a/IDE/Android/app/src/main/AndroidManifest.xml b/IDE/Android/app/src/main/AndroidManifest.xml
index f94f74da..1604ad3d 100644
--- a/IDE/Android/app/src/main/AndroidManifest.xml
+++ b/IDE/Android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
+
-
diff --git a/IDE/Android/app/src/main/java/com/example/wolfssl/MainActivity.java b/IDE/Android/app/src/main/java/com/example/wolfssl/MainActivity.java
index e77070ff..5a6022b4 100644
--- a/IDE/Android/app/src/main/java/com/example/wolfssl/MainActivity.java
+++ b/IDE/Android/app/src/main/java/com/example/wolfssl/MainActivity.java
@@ -22,11 +22,15 @@
package com.example.wolfssl;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Environment;
+import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
import android.widget.TextView;
-import android.Manifest;
-import android.content.pm.PackageManager;
import com.wolfssl.WolfSSL;
import com.wolfssl.WolfSSLException;
@@ -34,7 +38,6 @@
import com.wolfssl.provider.jsse.WolfSSLX509;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.KeyStore;
import java.security.KeyStoreException;
@@ -48,25 +51,38 @@
public class MainActivity extends AppCompatActivity {
+ private View.OnClickListener buttonListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ TextView tv = (TextView) findViewById(R.id.sample_text);
+
+ try {
+ testLoadCert(tv);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
@Override
protected void onCreate(Bundle savedInstanceState) {
int permission;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+ Button button = (Button) findViewById(R.id.button);
+ button.setOnClickListener(buttonListener);
+
TextView tv = (TextView) findViewById(R.id.sample_text);
tv.setText("wolfSSL JNI Android Studio Example App");
- permission = checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
- if (permission != PackageManager.PERMISSION_GRANTED) {
- requestPermissions(new String[] {Manifest.permission.READ_EXTERNAL_STORAGE},1);
- }
-
- try {
- testLoadCert(tv);
- } catch (Exception e) {
- e.printStackTrace();
+ if (Environment.isExternalStorageManager()) {
+ } else {
+ Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
+ Uri uri = Uri.fromParts("package", getPackageName(), null);
+ intent.setData(uri);
+ startActivity(intent);
}
}
diff --git a/IDE/Android/app/src/main/res/layout/activity_main.xml b/IDE/Android/app/src/main/res/layout/activity_main.xml
index 548354ac..1e49ea6b 100644
--- a/IDE/Android/app/src/main/res/layout/activity_main.xml
+++ b/IDE/Android/app/src/main/res/layout/activity_main.xml
@@ -1,20 +1,29 @@
-
+
+
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.067" />
\ No newline at end of file