FilePicker from android webview working only once - android

I need to pick an image from webview and upload it onto server. The code works, but if I press back without picking anything, next time the control does not goes in onShowFileChooser.
I have checked the same on android browser and it works there, so there has to be something that I am missing.
Below is the code:
web.setWebChromeClient(new BizzerClient());
web.setWebViewClient(new WebViewClient(){
//=========================================
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
if(url.contains(Domain) && !url.startsWith(SMS)){
//== if url is of same site and not related to sms, do nothing
}else{
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
return true;
}
return false;
}
});
//=========================================
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if(requestCode==FileChooser){
Uri result = intent == null || resultCode != RESULT_OK ?null:Uri.parse(intent.getDataString());
if(result==null) return;
if(fPathCallback!=null){
fPathCallback.onReceiveValue(new Uri[]{result});
fPathCallback = null;
}else{
upload.onReceiveValue(result);
upload = null;
}
}
}
//=====================================================
class BizzerClient extends WebChromeClient{
//=========================================
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
upload = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i,"File Chooser"), FileChooser);
}
//=========================================
//== For Android 3.0+
public void openFileChooser( ValueCallback uploadMsg, String acceptType ) {
upload = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
startActivityForResult(Intent.createChooser(i, "File Browser"),FileChooser);
}
//=========================================
//== For Android 4.1
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture){
upload = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult( Intent.createChooser( i, "File Chooser" ), FileChooser );
}
//=========================================
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,WebChromeClient.FileChooserParams fileChooserParams) {
fPathCallback = filePathCallback;
Toast.makeText(getApplicationContext(), "A", Toast.LENGTH_SHORT).show();
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i,"File Chooser"), FileChooser);
return true;
}
}
Does anyone know how to fix this?

My workmate has exactly same issue, he has fixed it by
upload.onReceiveValue(null)

I had the same issue, the problem was I was expecting an OnActivityResult, but when you press the back button, this was not triggered.
The solution was implementing on onResume the following code, to tell the callback the answer was empty and being able to reuse it:
#Override
protected void onResume() {
super.onResume();
if (fPathCallback == null)
return;
fPathCallback.onReceiveValue(new Uri[]{});
fPathCallback = null;
}

Related

Android Webview Duplicate Files when Selecting Image

I'm having a problem with uploading files on android webview which occurs when I select a file or camera to select then a CAPUTURE_OOOOOOOO.jpg file is formed which should only be formed when I manage to take a photo and take the image into the selected image file, here's the code with kotlin
myWebView.webChromeClient = object : WebChromeClient() {
override fun onShowFileChooser(webView: WebView, filePathCallback: ValueCallback<Array<Uri>>, fileChooserParams: FileChooserParams):Boolean {
chooserCallback = filePathCallback
val fileCamera = File(
Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES
), "CAPTURE_" + System.currentTimeMillis().toString() + ".jpg"
)
chooserCamera = Uri.fromFile(fileCamera)
val captureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, chooserCamera)
val imageIntent = Intent(Intent.ACTION_GET_CONTENT)
imageIntent.addCategory(Intent.CATEGORY_OPENABLE)
imageIntent.type = "image/*"
val chooserIntent = Intent.createChooser(imageIntent, "Select Image")
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(captureIntent))
startActivityForResult(chooserIntent, requestChooser)
return true
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == requestChooser) {
if (resultCode == Activity.RESULT_OK) {
Log.v("chooserCamera", data?.dataString.toString())
Log.v("dataString", data?.dataString.toString())
val result: Uri = if (data?.dataString == null) chooserCamera as Uri else data.data as Uri
chooserCallback?.onReceiveValue(arrayOf(result))
chooserCallback = null
}
if (resultCode == Activity.RESULT_CANCELED) {
Toast.makeText(applicationContext, "No Image", Toast.LENGTH_SHORT).show()
chooserCallback?.onReceiveValue(null)
chooserCallback = null
}
}
}
the CAPUTURE_OOOOOOOO.jpg file should only be formed when I take a photo with the camera and select it, not when I press the choose button so there is a duplication of files in this process, thank you
video recorded from virtual devices - Nexus 5 Api 30 : https://streamable.com/0kylsu
webView.setWebChromeClient(new WebChromeClient()
{
// For 3.0+ Devices (Start)
// onActivityResult attached before constructor
protected void openFileChooser(ValueCallback uploadMsg, String acceptType)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}
// For Lollipop 5.0+ Devices
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
{
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}
uploadMessage = filePathCallback;
Intent intent = fileChooserParams.createIntent();
try
{
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e)
{
uploadMessage = null;
Toast.makeText(getActivity().getApplicationContext(), "Cannot Open File Chooser", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
//For Android 4.1 only
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
{
mUploadMessage = uploadMsg;
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "File Browser"), FILECHOOSER_RESULTCODE);
}
protected void openFileChooser(ValueCallback<Uri> uploadMsg)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
}
});

Application is freezing when I scroll through my webview application

The application consists of a simple splash screen and webview. But when it comes to the webview side, there is a problem of freezing in the application. It doesn't work exactly when I scroll. There is no freeze in the normal browser. What is the problem
Splash Screen
public class SplashScreen extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
#Override
public void run() {
startActivity(new Intent(SplashScreen.this,MainActivity.class));
finish();
}
}, 1200);
}
}
Main Activity
public class MainActivity extends AppCompatActivity {
private final static int FCR = 1;
WebView webView;
private String mCM;
private ValueCallback<Uri> mUploadMessage;
public ValueCallback<Uri[]> uploadMessage;
public static final int REQUEST_SELECT_FILE = 100;
private final static int FILECHOOSER_RESULTCODE = 1;
#SuppressLint("WrongViewCast")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = findViewById(R.id.webView);
webView.loadUrl("https://dokuzlama.com");
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(false);
webSettings.setAllowFileAccess(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowContentAccess(true);
webView.setWebViewClient(new Callback());
webView.setWebChromeClient(new WebChromeClient()
{
// For 3.0+ Devices (Start)
// onActivityResult attached before constructor
protected void openFileChooser(ValueCallback uploadMsg, String acceptType)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}
// For Lollipop 5.0+ Devices
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
{
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}
uploadMessage = filePathCallback;
Intent intent = fileChooserParams.createIntent();
try
{
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e)
{
uploadMessage = null;
Toast.makeText(MainActivity.this.getApplicationContext(), "Cannot Open File Chooser", Toast.LENGTH_LONG).show();
//eski---- > Toast.makeText(getActivity().getApplicationContext(), "Cannot Open File Chooser", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
//For Android 4.1 only
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
{
mUploadMessage = uploadMsg;
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "File Browser"), FILECHOOSER_RESULTCODE);
}
protected void openFileChooser(ValueCallback<Uri> uploadMsg)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
}
});
}
public class Callback extends WebViewClient {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(getApplicationContext(), "Uygulama yüklenemedi", Toast.LENGTH_SHORT).show();
}
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode == REQUEST_SELECT_FILE) {
if (uploadMessage == null)
return;
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
uploadMessage = null;
}
} else if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage)
return;
// Use MainActivity.RESULT_OK if you're implementing WebView inside Fragment
// Use RESULT_OK only if you're implementing WebView inside an Activity
Uri result = intent == null || resultCode != MainActivity.RESULT_OK ? null : intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else
Toast.makeText(MainActivity.this.getApplicationContext(), "Failed to Upload Image", Toast.LENGTH_LONG).show();
//eski____ Toast.makeText(getActivity().getApplicationContext(), "Failed to Upload Image", Toast.LENGTH_LONG).show();
}
#Override
public void onBackPressed() {
if (webView.canGoBack()){
webView.goBack();
} else {
super.onBackPressed();
}
}
}
I researched and analyzed a lot but I couldn't find
Try enabling hardware acceleration in manifest in your activity
android:hardwareAccelerated="true"

File Explorer not opening on webview, opening on regular mobile browser

So I've made a WebView for a friend's website for a project, the website includes a file's uploader, which when you click on it on a regular mobile/pc browser it opens the filesbrowser/explorer to look for the file to upload into the website.
But in the case of the WebView I've made, when I click the file uploader it just clicks without lunching the File Explorer of the phone so I can select files I wish to upload.
Any suggestions ? Thanks.
#Simo You have to set chrome client for your WebView. Please check below code
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAllowContentAccess(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.setWebChromeClient(new WebChromeClient()
{
// For 3.0+ Devices (Start)
// onActivityResult attached before constructor
protected void openFileChooser(ValueCallback uploadMsg, String acceptType)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}
// For Lollipop 5.0+ Devices
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
{
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}
uploadMessage = filePathCallback;
Intent intent = fileChooserParams.createIntent();
try
{
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e)
{
uploadMessage = null;
Toast.makeText(getApplicationContext(), "Cannot Open File Chooser", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
//For Android 4.1 only
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
{
mUploadMessage = uploadMsg;
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "File Browser"), FILECHOOSER_RESULTCODE);
}
protected void openFileChooser(ValueCallback<Uri> uploadMsg)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
}
});
Also override onActivityResult like below
#Override
public void onActivityResult(int requestCode, int resultCode, Intent intent)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
if (requestCode == REQUEST_SELECT_FILE)
{
if (uploadMessage == null)
return;
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
uploadMessage = null;
}
}
else if (requestCode == FILECHOOSER_RESULTCODE)
{
if (null == mUploadMessage)
return;
// Use MainActivity.RESULT_OK if you're implementing WebView inside Fragment
// Use RESULT_OK only if you're implementing WebView inside an Activity
Uri result = intent == null || resultCode != MainActivity.RESULT_OK ? null : intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
else
Toast.makeText(getApplicationContext(), "Failed to Upload Image", Toast.LENGTH_LONG).show();
}
Source: WebView File Upload

Webview client file openfilechooser returns blank white screen

There are a few questions on the issue of making a openfilechooser work on Android and I have applied the recommended solutions.
My issue is not that its not working on 4.4 yet as I will tackle that next, but I just need it to work on my test device 4.2.2 (Note8) but its returning a blank white screen once the image is selected.
I have rechecked my code and reviewed many many solutions and they all are giving the same solution, but I just cant seem to find whats wrong.
Heres my code:
private ValueCallback<Uri> mUploadMessage;
private final static int FILECHOOSER_RESULTCODE=1;
#Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if(requestCode==FILECHOOSER_RESULTCODE)
{
if (null == mUploadMessage) return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_team_page);
mHandler = new Handler();
getUser = ((MyData)getApplicationContext());
TimeZone tz = TimeZone.getDefault();
Date now = new Date();
int offsetFromUtc = tz.getOffset(now.getTime()) / 3600000;
m2tTimeZoneIs = Integer.toString(offsetFromUtc);
userCredentials = getApplicationContext().getSharedPreferences("me2team", MODE_PRIVATE);
isShowingDesktop = false;
m2tUser = getUser.getCredentialsUser();
m2tPswd = getUser.getCredentialsPwd();
isPremiumUser = getUser.getPremiumUser();
tempWebURL = getResources().getString(R.string.teamURLMobile);
webURL = tempWebURL + "?username=" + m2tUser + "&password=" + m2tPswd + "&mobile=1&offSetHours=" + m2tTimeZoneIs;
webView = (WebView) findViewById(R.id.teamWebView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSavePassword(false);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(false); //as per Janet's request
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
webView.getSettings().setLoadWithOverviewMode(true);
webView.setInitialScale(70);
WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);
webView.setAlpha(255);
webView.setWebChromeClient(new WebChromeClient() {
#SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
TeamPage.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);
}
// For Android 3.0+
#SuppressWarnings("unused")
public void openFileChooser( ValueCallback uploadMsg, String acceptType ) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
TeamPage.this.startActivityForResult(
Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}
//For Android 4.1
#SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture){
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
TeamPage.this.startActivityForResult( Intent.createChooser( i, "File Chooser" ), TeamPage.FILECHOOSER_RESULTCODE );
}
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
{
activity.setTitle(R.string.app_name);
}
}
});
webView.setWebViewClient(new WebViewClient());
I checked with the server chap and he is not seeing any errors on his side when I select the file, so its like it just stops doing anything. Thing is if I log out of the web site and then go log back in, I still get the same white screen? Its not till I restart the app that it returns to the web page (remembers login details and auto logs in).
And ideas?

WebViewClient and fileChooser

I have a problem.. :(
I have a custom webView implemented myself like an extends WebViewClient.
In the html side of the application I have a tag <input type='file' id='media' name='media' accept="image/*" capture="camera" /> but I can not make it works!
I follow a lot of tutorial but all of them use WebChromeclient; in my case, because the complexity of the application, I use a WebViewClient.
Is there a solution?
Please..
Here there is my class
public class MyWebView extends WebViewClient{
private static Context context;
private static HttpClient client;
private static SharedPreferences prefs;
public MyWebView(Context context, HttpClient client, SharedPreferences prefs){
super();
MyWebView.context = context;
MyWebView.client = client;
MyWebView.prefs = prefs;
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//some operation with cookie
}
I was having the same issue for webview.
Let suppose ur html looks like
<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
here is the whole which solved my problem
package com.example.webviewtest;
public class MainActivity extends Activity {
private WebView wv;
private ValueCallback<Uri> mUploadMessage;
private final static int FILECHOOSER_RESULTCODE = 1;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
wv = new WebView(this);
wv.setWebViewClient(new WebViewClient());
wv.setWebChromeClient(new WebChromeClient() {
// The undocumented magic method override
// Eclipse will swear at you if you try to put #Override here
// For Android < 3.0
public void openFileChooser(ValueCallback uploadMsg) {
Log.i("For Android < 3.0", "called");
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
MainActivity.this.startActivityForResult(
Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}
// For Android 3.0+
public void openFileChooser(ValueCallback uploadMsg,
String acceptType) {
Log.i("For Android 3.0+", "called");
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
MainActivity.this.startActivityForResult(
Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
openFileChooser(uploadMsg);
Log.i("For Android Jellybeans", "called");
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
MainActivity.this.startActivityForResult(
Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}
});
setContentView(wv);
wv.loadUrl("http://blue.genetechz.com/qadir/");
}
#Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
Log.i("onActivityResult", "called");
if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage){
Log.i("if", "return called");
return;
}else{
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
Log.i("else", "inner Called");
}
} else {
Log.i("Else", "Called");
// super.onActivityResult(requestCode, resultCode, intent);
// IPlugin callback = this.activityResultCallback;
// if (callback != null) {
// callback.onActivityResult(requestCode, resultCode, intent);
// }
}
}
#Override
public void onBackPressed() {
if (wv.canGoBack() == true) {
wv.goBack();
} else {
MainActivity.this.finish();
}
}
}

Categories

Resources