webView upload photo to wix forum issue











up vote
0
down vote

favorite












I am trying to build an app that simply opens webview and goes to my forum page on my website, but I can not figure out why I can't upload photos. I don't think permissions is the issue since I set the app to request permissions on open (although you have to open the app twice to get both prompts for camera and read/write permissions) When I click upload photo nothing at all happens. The website works perfectly fine in a normal web browser app. The Website was made with Wix.



I've read what feels like a hundred answers to similar questions, and either none of the work, they're outdated, or I don't understand any of them. I've read things saying it's something to do with Java alerts or to use WebChromeClient but my biggest issue is I don't really know what the problem truly is to try to find the answer or how to actually code a solution.



I am going to put all my code here, but I don't just want the answer to how to fix it, I want to know why it isn't working, and how I can figure out how to fix issues like these in the future on my own.



activity main XML



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".MainActivity">

<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" />

<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">

</com.google.android.gms.ads.AdView>

</RelativeLayout>


MainActivity JAVA



package inventory.csdc.com.csdcinventory;

import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity {
private AdView mAdView;
WebView webview;

private static final String TAG = "MainActivity";
private static final String CAMERA_PERMISSIONS = {
Manifest.permission.CAMERA};
private static final String STORAGE_PERMISSIONS ={
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

verifyPermissions();

webview = findViewById(R.id.webview);
webview.getSettings() .setJavaScriptEnabled(true);
webview.getSettings() .setJavaScriptCanOpenWindowsAutomatically(true);
webview.getSettings() .setRenderPriority(WebSettings.RenderPriority.HIGH);
webview.getSettings() .setAppCacheEnabled(true);
webview.loadUrl("https://funforums.wixsite.com/csdc");
webview.setWebViewClient(new WebViewClient());
webview.setWebChromeClient(new WebChromeClient());
webview.getSettings() .setUseWideViewPort(true);

MobileAds.initialize(this, "MY ADMOB ID");

mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

}


@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {


// Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
webview.goBack();
return true;
}
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}


private void verifyPermissions(){
Log.d(TAG, "verifyPermissions: Checking Permissions");

int permissionCamera = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA);
int permissionExternalMemory = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

if (permissionExternalMemory != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
MainActivity.this,
STORAGE_PERMISSIONS,
1
);
}
if (permissionCamera != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(
MainActivity.this,
CAMERA_PERMISSIONS,
1
);
}

}

}


AndroidManifest XML



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="inventory.csdc.com.csdcinventory">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


<application
android:allowBackup="true"
android:icon="@mipmap/ic_dance2"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[MY ADMOB ID]" />

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>


build gradle (app)



apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "inventory.csdc.com.csdcinventory"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.android.support:customtabs:27.1.1'
}


build gradle (CSDCInventory2)



buildscript {

repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()

maven {
url "https://maven.google.com"
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}









share|improve this question




























    up vote
    0
    down vote

    favorite












    I am trying to build an app that simply opens webview and goes to my forum page on my website, but I can not figure out why I can't upload photos. I don't think permissions is the issue since I set the app to request permissions on open (although you have to open the app twice to get both prompts for camera and read/write permissions) When I click upload photo nothing at all happens. The website works perfectly fine in a normal web browser app. The Website was made with Wix.



    I've read what feels like a hundred answers to similar questions, and either none of the work, they're outdated, or I don't understand any of them. I've read things saying it's something to do with Java alerts or to use WebChromeClient but my biggest issue is I don't really know what the problem truly is to try to find the answer or how to actually code a solution.



    I am going to put all my code here, but I don't just want the answer to how to fix it, I want to know why it isn't working, and how I can figure out how to fix issues like these in the future on my own.



    activity main XML



    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    tools:context=".MainActivity">

    <WebView
    android:id="@+id/webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000" />

    <com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-3940256099942544/6300978111">

    </com.google.android.gms.ads.AdView>

    </RelativeLayout>


    MainActivity JAVA



    package inventory.csdc.com.csdcinventory;

    import android.Manifest;
    import android.content.pm.PackageManager;
    import android.os.Bundle;
    import android.support.v4.app.ActivityCompat;
    import android.support.v7.app.AppCompatActivity;
    import android.util.Log;
    import android.view.KeyEvent;
    import android.webkit.WebChromeClient;
    import android.webkit.WebSettings;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;
    import com.google.android.gms.ads.AdRequest;
    import com.google.android.gms.ads.AdView;
    import com.google.android.gms.ads.MobileAds;

    public class MainActivity extends AppCompatActivity {
    private AdView mAdView;
    WebView webview;

    private static final String TAG = "MainActivity";
    private static final String CAMERA_PERMISSIONS = {
    Manifest.permission.CAMERA};
    private static final String STORAGE_PERMISSIONS ={
    Manifest.permission.READ_EXTERNAL_STORAGE,
    Manifest.permission.WRITE_EXTERNAL_STORAGE};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    verifyPermissions();

    webview = findViewById(R.id.webview);
    webview.getSettings() .setJavaScriptEnabled(true);
    webview.getSettings() .setJavaScriptCanOpenWindowsAutomatically(true);
    webview.getSettings() .setRenderPriority(WebSettings.RenderPriority.HIGH);
    webview.getSettings() .setAppCacheEnabled(true);
    webview.loadUrl("https://funforums.wixsite.com/csdc");
    webview.setWebViewClient(new WebViewClient());
    webview.setWebChromeClient(new WebChromeClient());
    webview.getSettings() .setUseWideViewPort(true);

    MobileAds.initialize(this, "MY ADMOB ID");

    mAdView = findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {


    // Check if the key event was the Back button and if there's history
    if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
    webview.goBack();
    return true;
    }
    // If it wasn't the Back key or there's no web page history, bubble up to the default
    // system behavior (probably exit the activity)
    return super.onKeyDown(keyCode, event);
    }


    private void verifyPermissions(){
    Log.d(TAG, "verifyPermissions: Checking Permissions");

    int permissionCamera = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA);
    int permissionExternalMemory = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

    if (permissionExternalMemory != PackageManager.PERMISSION_GRANTED) {
    ActivityCompat.requestPermissions(
    MainActivity.this,
    STORAGE_PERMISSIONS,
    1
    );
    }
    if (permissionCamera != PackageManager.PERMISSION_GRANTED){
    ActivityCompat.requestPermissions(
    MainActivity.this,
    CAMERA_PERMISSIONS,
    1
    );
    }

    }

    }


    AndroidManifest XML



    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="inventory.csdc.com.csdcinventory">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_dance2"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="[MY ADMOB ID]" />

    <activity android:name=".MainActivity">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    </application>

    </manifest>


    build gradle (app)



    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 27
    defaultConfig {
    applicationId "inventory.csdc.com.csdcinventory"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.android.gms:play-services-ads:17.0.0'
    implementation 'com.android.support:customtabs:27.1.1'
    }


    build gradle (CSDCInventory2)



    buildscript {

    repositories {
    google()
    jcenter()

    }
    dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
    }

    allprojects {
    repositories {
    google()
    jcenter()

    maven {
    url "https://maven.google.com"
    }
    }
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to build an app that simply opens webview and goes to my forum page on my website, but I can not figure out why I can't upload photos. I don't think permissions is the issue since I set the app to request permissions on open (although you have to open the app twice to get both prompts for camera and read/write permissions) When I click upload photo nothing at all happens. The website works perfectly fine in a normal web browser app. The Website was made with Wix.



      I've read what feels like a hundred answers to similar questions, and either none of the work, they're outdated, or I don't understand any of them. I've read things saying it's something to do with Java alerts or to use WebChromeClient but my biggest issue is I don't really know what the problem truly is to try to find the answer or how to actually code a solution.



      I am going to put all my code here, but I don't just want the answer to how to fix it, I want to know why it isn't working, and how I can figure out how to fix issues like these in the future on my own.



      activity main XML



      <?xml version="1.0" encoding="utf-8"?>
      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#000000"
      tools:context=".MainActivity">

      <WebView
      android:id="@+id/webview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#000000" />

      <com.google.android.gms.ads.AdView
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:id="@+id/adView"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_alignParentBottom="true"
      ads:adSize="BANNER"
      ads:adUnitId="ca-app-pub-3940256099942544/6300978111">

      </com.google.android.gms.ads.AdView>

      </RelativeLayout>


      MainActivity JAVA



      package inventory.csdc.com.csdcinventory;

      import android.Manifest;
      import android.content.pm.PackageManager;
      import android.os.Bundle;
      import android.support.v4.app.ActivityCompat;
      import android.support.v7.app.AppCompatActivity;
      import android.util.Log;
      import android.view.KeyEvent;
      import android.webkit.WebChromeClient;
      import android.webkit.WebSettings;
      import android.webkit.WebView;
      import android.webkit.WebViewClient;
      import com.google.android.gms.ads.AdRequest;
      import com.google.android.gms.ads.AdView;
      import com.google.android.gms.ads.MobileAds;

      public class MainActivity extends AppCompatActivity {
      private AdView mAdView;
      WebView webview;

      private static final String TAG = "MainActivity";
      private static final String CAMERA_PERMISSIONS = {
      Manifest.permission.CAMERA};
      private static final String STORAGE_PERMISSIONS ={
      Manifest.permission.READ_EXTERNAL_STORAGE,
      Manifest.permission.WRITE_EXTERNAL_STORAGE};


      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      verifyPermissions();

      webview = findViewById(R.id.webview);
      webview.getSettings() .setJavaScriptEnabled(true);
      webview.getSettings() .setJavaScriptCanOpenWindowsAutomatically(true);
      webview.getSettings() .setRenderPriority(WebSettings.RenderPriority.HIGH);
      webview.getSettings() .setAppCacheEnabled(true);
      webview.loadUrl("https://funforums.wixsite.com/csdc");
      webview.setWebViewClient(new WebViewClient());
      webview.setWebChromeClient(new WebChromeClient());
      webview.getSettings() .setUseWideViewPort(true);

      MobileAds.initialize(this, "MY ADMOB ID");

      mAdView = findViewById(R.id.adView);
      AdRequest adRequest = new AdRequest.Builder().build();
      mAdView.loadAd(adRequest);

      }


      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {


      // Check if the key event was the Back button and if there's history
      if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
      webview.goBack();
      return true;
      }
      // If it wasn't the Back key or there's no web page history, bubble up to the default
      // system behavior (probably exit the activity)
      return super.onKeyDown(keyCode, event);
      }


      private void verifyPermissions(){
      Log.d(TAG, "verifyPermissions: Checking Permissions");

      int permissionCamera = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA);
      int permissionExternalMemory = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

      if (permissionExternalMemory != PackageManager.PERMISSION_GRANTED) {
      ActivityCompat.requestPermissions(
      MainActivity.this,
      STORAGE_PERMISSIONS,
      1
      );
      }
      if (permissionCamera != PackageManager.PERMISSION_GRANTED){
      ActivityCompat.requestPermissions(
      MainActivity.this,
      CAMERA_PERMISSIONS,
      1
      );
      }

      }

      }


      AndroidManifest XML



      <?xml version="1.0" encoding="utf-8"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="inventory.csdc.com.csdcinventory">

      <uses-permission android:name="android.permission.INTERNET"/>
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.CAMERA"/>
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


      <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_dance2"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">

      <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="[MY ADMOB ID]" />

      <activity android:name=".MainActivity">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />

      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>

      </manifest>


      build gradle (app)



      apply plugin: 'com.android.application'

      android {
      compileSdkVersion 27
      defaultConfig {
      applicationId "inventory.csdc.com.csdcinventory"
      minSdkVersion 15
      targetSdkVersion 27
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
      release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
      }
      }

      dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:27.1.1'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.google.android.gms:play-services-ads:17.0.0'
      implementation 'com.android.support:customtabs:27.1.1'
      }


      build gradle (CSDCInventory2)



      buildscript {

      repositories {
      google()
      jcenter()

      }
      dependencies {
      classpath 'com.android.tools.build:gradle:3.2.1'


      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
      }
      }

      allprojects {
      repositories {
      google()
      jcenter()

      maven {
      url "https://maven.google.com"
      }
      }
      }

      task clean(type: Delete) {
      delete rootProject.buildDir
      }









      share|improve this question















      I am trying to build an app that simply opens webview and goes to my forum page on my website, but I can not figure out why I can't upload photos. I don't think permissions is the issue since I set the app to request permissions on open (although you have to open the app twice to get both prompts for camera and read/write permissions) When I click upload photo nothing at all happens. The website works perfectly fine in a normal web browser app. The Website was made with Wix.



      I've read what feels like a hundred answers to similar questions, and either none of the work, they're outdated, or I don't understand any of them. I've read things saying it's something to do with Java alerts or to use WebChromeClient but my biggest issue is I don't really know what the problem truly is to try to find the answer or how to actually code a solution.



      I am going to put all my code here, but I don't just want the answer to how to fix it, I want to know why it isn't working, and how I can figure out how to fix issues like these in the future on my own.



      activity main XML



      <?xml version="1.0" encoding="utf-8"?>
      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#000000"
      tools:context=".MainActivity">

      <WebView
      android:id="@+id/webview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#000000" />

      <com.google.android.gms.ads.AdView
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:id="@+id/adView"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_alignParentBottom="true"
      ads:adSize="BANNER"
      ads:adUnitId="ca-app-pub-3940256099942544/6300978111">

      </com.google.android.gms.ads.AdView>

      </RelativeLayout>


      MainActivity JAVA



      package inventory.csdc.com.csdcinventory;

      import android.Manifest;
      import android.content.pm.PackageManager;
      import android.os.Bundle;
      import android.support.v4.app.ActivityCompat;
      import android.support.v7.app.AppCompatActivity;
      import android.util.Log;
      import android.view.KeyEvent;
      import android.webkit.WebChromeClient;
      import android.webkit.WebSettings;
      import android.webkit.WebView;
      import android.webkit.WebViewClient;
      import com.google.android.gms.ads.AdRequest;
      import com.google.android.gms.ads.AdView;
      import com.google.android.gms.ads.MobileAds;

      public class MainActivity extends AppCompatActivity {
      private AdView mAdView;
      WebView webview;

      private static final String TAG = "MainActivity";
      private static final String CAMERA_PERMISSIONS = {
      Manifest.permission.CAMERA};
      private static final String STORAGE_PERMISSIONS ={
      Manifest.permission.READ_EXTERNAL_STORAGE,
      Manifest.permission.WRITE_EXTERNAL_STORAGE};


      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      verifyPermissions();

      webview = findViewById(R.id.webview);
      webview.getSettings() .setJavaScriptEnabled(true);
      webview.getSettings() .setJavaScriptCanOpenWindowsAutomatically(true);
      webview.getSettings() .setRenderPriority(WebSettings.RenderPriority.HIGH);
      webview.getSettings() .setAppCacheEnabled(true);
      webview.loadUrl("https://funforums.wixsite.com/csdc");
      webview.setWebViewClient(new WebViewClient());
      webview.setWebChromeClient(new WebChromeClient());
      webview.getSettings() .setUseWideViewPort(true);

      MobileAds.initialize(this, "MY ADMOB ID");

      mAdView = findViewById(R.id.adView);
      AdRequest adRequest = new AdRequest.Builder().build();
      mAdView.loadAd(adRequest);

      }


      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {


      // Check if the key event was the Back button and if there's history
      if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
      webview.goBack();
      return true;
      }
      // If it wasn't the Back key or there's no web page history, bubble up to the default
      // system behavior (probably exit the activity)
      return super.onKeyDown(keyCode, event);
      }


      private void verifyPermissions(){
      Log.d(TAG, "verifyPermissions: Checking Permissions");

      int permissionCamera = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA);
      int permissionExternalMemory = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

      if (permissionExternalMemory != PackageManager.PERMISSION_GRANTED) {
      ActivityCompat.requestPermissions(
      MainActivity.this,
      STORAGE_PERMISSIONS,
      1
      );
      }
      if (permissionCamera != PackageManager.PERMISSION_GRANTED){
      ActivityCompat.requestPermissions(
      MainActivity.this,
      CAMERA_PERMISSIONS,
      1
      );
      }

      }

      }


      AndroidManifest XML



      <?xml version="1.0" encoding="utf-8"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="inventory.csdc.com.csdcinventory">

      <uses-permission android:name="android.permission.INTERNET"/>
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.CAMERA"/>
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


      <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_dance2"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">

      <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="[MY ADMOB ID]" />

      <activity android:name=".MainActivity">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />

      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>

      </manifest>


      build gradle (app)



      apply plugin: 'com.android.application'

      android {
      compileSdkVersion 27
      defaultConfig {
      applicationId "inventory.csdc.com.csdcinventory"
      minSdkVersion 15
      targetSdkVersion 27
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
      release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
      }
      }

      dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:27.1.1'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.google.android.gms:play-services-ads:17.0.0'
      implementation 'com.android.support:customtabs:27.1.1'
      }


      build gradle (CSDCInventory2)



      buildscript {

      repositories {
      google()
      jcenter()

      }
      dependencies {
      classpath 'com.android.tools.build:gradle:3.2.1'


      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
      }
      }

      allprojects {
      repositories {
      google()
      jcenter()

      maven {
      url "https://maven.google.com"
      }
      }
      }

      task clean(type: Delete) {
      delete rootProject.buildDir
      }






      webview permissions camera upload wixcode






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 at 11:15









      Ashley Mills

      27.9k883110




      27.9k883110










      asked Nov 10 at 22:37









      Ryan Achata

      12




      12





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244115%2fwebview-upload-photo-to-wix-forum-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244115%2fwebview-upload-photo-to-wix-forum-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues