Commit 8e8ccec0 authored by Craig Earley's avatar Craig Earley
Browse files

adds a prompt for local file read and write permissions to database actions

parent 65761c72
package fieldscience.cs.earlham.edu.fieldday;
import android.Manifest;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.Cursor;
import android.os.AsyncTask;
......@@ -25,6 +27,7 @@ import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import java.sql.Connection;
import java.sql.DriverManager;
......@@ -278,6 +281,18 @@ public class DatabaseActionsActivity extends AppCompatActivity {
private void verify(final View view){
AlertDialog.Builder builder = new AlertDialog.Builder(DatabaseActionsActivity.this);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED ) {
ActivityCompat.requestPermissions(DatabaseActionsActivity.this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
1);
return;
}
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED ) {
ActivityCompat.requestPermissions(DatabaseActionsActivity.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
1);
return;
}
switch(view.getId()){
case R.id.setupDbButton:
builder.setMessage("Are you sure that you want to setup your local database?");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment