private void WebBrowser_Clicked(object sender, RoutedEventArgs e)
{
wb.Navigate("C:/Users/intern3/source/repos/MarketingProject/Samples/WPF/RESTToolkitTestApp/index.htm");
wb.InvokeScript("SetCoords", new object[] { coord1, coord2 });
}
wb is a WebBrowser object
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" />
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=AgCKDO35_SFD68BDTuy_QuFz48T2P3FmYQKttx8y2DXQNR-ufCeae5riWUYmPCmk' async defer></script>
<script type='text/javascript'>
var map;
var lattitude = 34.2;
var longitude = -117.8;
function SetCoords(lat, long) {
lattitude = lat;
longitude = long;
}
...
I've tried adding the coordinates to the end of the url as a querystring but since it's a local file I don't think it's possible. If it is please let me know because that would be an easy solution to this too. But otherwise, this is giving me this error:
System.Runtime.InteropServices.COMException: 'Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))'
It takes some time until the WebBrowser control has loaded the page so that it knows the Javascript function. Instead of calling the function directly after the load, use a handler for the LoadCompleted event to run the function, e.g.:
public MyForm() // This is the constructor of your form/page
{
InitializeComponent();
wb.LoadCompleted += WebBrowser_LoadCompleted;
}
private void WebBrowser_Clicked(object sender, RoutedEventArgs e)
{
wb.Navigate("C:/Users/intern3/source/repos/MarketingProject/Samples/WPF/RESTToolkitTestApp/index.htm");
}
private void WebBrowser_LoadCompleted(object sender, NavigationEventArgs e)
{
wb.InvokeScript("SetCoords", new object[] { coord1, coord2 });
}
Above code adds the handler for LoadCompleted manually, but you can also add it in the designer.
Related
Hello i am trying to call a method from a js file from Blazor.
My file structure is like this:
-root
-JSInterop.cs
-js(folder)
-meth.js (file containing the js method)
I keep getting the following error :
Could not find 'methods' in 'window'.
**Cs class that calls the js **
public class JSInterop {
public static async Task<string> ChangeText() {
try {
var data = await JSRuntime.Current.InvokeAsync<string>("./js/meth/methods.print","mymessage");
Console.WriteLine($"ReturnedFromJS:{data}");
return data;
} catch (Exception ex) {
return ex.Message;
}
}
}
Js file
function print(message){
return "fromJs"+message;
}
window.methods = {
print: function (message) {
return "from js" + message;
}
}
I have tried both putting just the method and putting it as a property in the window.I am not sure in the first case how do you refer a method from a file in js.
"[path to file]/[containingfile]/[methodname]" ?
or i have also tried "[path to file] / window.[methodname]"
to no avail (in the second case)
Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<title>Sms.Studio.Web</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>Loading...</app>
<!-- browser -->
<script src="_framework/blazor.webassembly.js"></script>
<script src="../interop/js/meth.js"></script>
</body>
</html>
JSRuntime.Current.InvokeAsync takes a js function identifier relative to the global window scope as its first argument. So in your js file you may have :
window.methods = {
print: function (message) {
return "from js" + message
}
Add your js file in index.html
<script src="css/bootstrap/bootstrap-native.min.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
<script src="js/meth.js"></script>
and call it from .Net as follows
await JSRuntime.Current.InvokeAsync<string>("methods.print","mymessage");
// Try this:
// Don't call your class JSInterop
public class MyJSInterop {
public static async Task<string> ChangeText() {
try {
var data = await JSRuntime.Current.InvokeAsync<string>("methods.print","mymessage");
Console.WriteLine($"ReturnedFromJS:{data}");
return data;
} catch (Exception ex) {
return ex.Message;
}
}
}
// Js file
window.methods = {
print: function (message) {
return "from js" + message;
}
};
Below is an end to end example of writing cookie.
step 1 - Add MatButton and sets it onClick attribute to delegate.
<MatButton TrailingIcon="favorite" #onclick="#(async () => await AddItemtoShoppingCart(#item))" Label="add"></MatButton>
Step 2
#code{
public async Task AddItemtoShoppingCart(FoodItem selectedItem)
{
var test = await JSRuntime.InvokeAsync<object>("blazorExtensions.WriteCookie", "cookieName", "cookieValue", "cookieExpiryDate");
}
}
Step 3 - Add below javasceipt in_Host.cshtml
<script>
window.blazorExtensions = {
WriteCookie: function (name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
}
</script>
Scenario:
I have an application being built in Visual Studio using ASP.NET. The application is being hosted on an IIS server. In the application there is an asp.net page with mostly html elements that references a javascript file that allows the user to draw a signature in a canvas and then submit it with an email.
The Goal with this is to have a webpage that allows the user to give their email and signature, click accept, and send that data to the C# method that will attach the signature and email it to the address.
I have tried multiple ways and done some good ajax research but have had no luck. I can't see any errors in the Visual Studio debugger. When i click the send button the text changes to Sending... but never goes further. I have yet to complete and write out the email portion of the method. At this point i just want to be able to pass in the JSON object with the email and canvas image. and somehow display the email (just to verify it was sent through).
What might i be doing wrong here? I'm thinking my issue lies in the ajax statement in the application.js, but have tried multiple ways of sending with no luck.
EDIT::: I am receiving the error code from the POST statement like
Internal Server Error
jquery-1.7.min.js:4 POST http://localhost:port#/SigCapture.aspx/SendMail 500 (Internal Server Error)
send # jquery-1.7.min.js:4
ajax # jquery-1.7.min.js:4
onSubmitClick # application.js:28
dispatch # jquery-1.7.min.js:3
i # jquery-1.7.min.js:3\
Update: I have received a new error after making the WebMethod a public static method so it can be seen by the ajax statement.
{Message: "Invalid JSON primitive: method.",…}
ExceptionType
:
"System.ArgumentException"
Message
:
"Invalid JSON primitive: method."
Here is the code:
NAME: SigCapture.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="SigCapture.aspx.cs" Inherits="mytest.SigCapture" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name=viewport content="width=device-width, initial-scale=1.0,
minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" href="assets/styles.css" />
<title>Signature Capture</title>
<script src="js/jquery-1.7.min.js" type="text/javascript"></script>
<script src="js/modernizr.custom.34982.js" type="text/javascript"></script>
<script src="js/application.js" type="text/javascript"></script>
<script src="js/signatureCapture.js" type="text/javascript"></script>
</head>
<body>
<form id="mainform" runat="server">
<img src="assets/phonegap.png" alt=""/>
<asp:Button ID="btn1" runat="server" Text="Clickme" OnClick="btn1_Click" />
<h2 runat="server">SAMPLE FORM</h2>
<asp:Label id="labeltext" runat="server" Text="Enter your email and `Sign the form"/>`
</form>
<h2>EMAIL</h2>
<input id="email" type="email" />
<p id="text"></p>
<h2>SIGNATURE</h2>
<div id="canvasContainer" width="100%">
<canvas id="signature" height="200px" />
</div>
<div id="lowerControls">
<div id="feedback"></div>
<div id="buttonsContainer">
<input type="image" id="submit" src="assets/accept.png" />
<input type="image" id="cancel" src="assets/cancel.png" />
</div>
</div>
</body>
</html>
NAME: SigCapture.apsx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace mytest
{
public partial class SigCapture : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn1_Click(object sender, EventArgs e)
{
labeltext.Text = "DER_";
}
public void test(object sender, EventArgs e, string name)
{
labeltext.Text = "DER_";
}
[WebMethod]
public string SendMail(object data)
{
return data.ToString();
}
}
}
NAME: application.js
// JavaScript Document
var sigCapture = null;
$(document).ready(function(e) {
sigCapture = new SignatureCapture( "signature" );
$("#submit").click( onSubmitClick );
$("#cancel").click( onCancelClick );
});
function onSubmitClick( event ) {
if ( verifyEmail() )
{
$("#text").html("CLICKED");
$("#feedback").html( "Sending..." );
var email = $("#email").val();
var sig = sigCapture.toString();
var data = { "method":"submitSignature",
"email":email,
"signature":sig,
"returnformat":"json" };
var url = 'SigCapture.aspx/SendMail';
$.ajax({
type: 'POST',
url: url,
data: data,
contentType: 'application/json; charset=utf-8',
datatype: 'json',
success: requestSuccess,
error: requestError
});
}
else {
$("#feedback").html( "Please enter a valid email address." );
}
}
function onCancelClick( event ) {
clearForm();
}
function clearForm() {
$("#email").val( "" );
sigCapture.clear();
$("#feedback").html( "" );
}
function requestSuccess( data, textStatus, jqXHR ) {
clearForm();
$("#feedback").html( "Thank you." );
}
function requestError( jqXHR, textStatus, errorThrown ) {
$("#feedback").html( "Error: " + errorThrown );
}
function verifyEmail() {
var re = /^(([^<>()[\]\\.,;:\s#\"]+(\.[^<>()[\]\\.,;:\s#\"]+)*)|(\".+\"))#((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test( $("#email").val() );
}
I'm learning how to use jquery autocomplete, I make an example about the $.get method in ajax.
I take a look at http://jqueryui.com/autocomplete/ to make this example.
In my jsp page:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AJAX calls using Jquery in Servlet</title>
<link rel="stylesheet" href="jquery-ui.css" />
<script src="jquery-1.9.1.js"></script>
<script src="jquery-ui.js"></script>
<script>
$(function(){
$('#user').autocomplete({
source: function (request, response) {
var username = $('#user').val();
$.get('autocompleteServlet', {user : username}, function(responseText){
$('#welcometext').text(responseText);
var value = [responseText];
response(value);
});
}
});
});
</script>
</head>
<body>
<form id="form1">
<h1>AJAX Demo using Jquery in JSP and Servlet</h1>
Enter your Name: <input type="text" id="user" /> <input type="button"
id="submit" value="Ajax Submit" /> <br />
<div id="welcometext"></div>
</form>
</body>
</html>
In servlet :
#Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String value = request.getParameter("user");
System.out.println("user : "+ value);
try {
Connection cnn = XJdbc.getConnection();
String sql = "SELECT Name FROM reported_tasks WHERE Name LIKE '%"+ value + "%'";
Statement stm = cnn.createStatement();
ResultSet rs = stm.executeQuery(sql);
String result = "";
while (rs.next()) {
result = result + rs.getString("Name") + ",";
}
cnn.close();
System.out.println("Request :" + result);
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
response.getWriter().print(result);
} catch (Exception e) {
System.out.println("Error : " + e.getMessage());
}
}
I think that the problem is how to return ajax response as an array type of javascript.
Please help me how to fix that, thanks all
Your servlet's response currently will produce something like:
name1,name2,name3,...
The response function is looking for an array of strings in your case, though it can take an array of objects in other formats.
I would recommend having your servlet output something like this:
{ "names" : ["name1","name2","name3"...,"nameX"] }
Your Javascript to process the above response would be
$.get('autocompleteServlet', {user : username}, function(responseText){
// I assume the next line is for debugging?
$('#welcometext').text(responseText);
var obj = $.parseJSON(responseText);
response(obj.names);
});
I am loading a HTML file file from server inside UIWebView. In HTML file, we have external links to open and a Javascript function is written to handle that events.I want to open that hyperlinks inside a seperate new webview within the app.
Is there any way that server side javascript method notify to objective-C or any callback function which will call in objective-C and then i can do someting in my code? i have seen the example of WEBViewJavaScriptBridge to communicate between javascript and objective C. but they are using the local HTML file to load and communicate.Bt my HTML file is on server side.It would be great if anyone can help on this.
I am puuting a sample HTML file here. We have two hypelinks "Open" and "Close" on taping on open button a function is called that show alert. so instead of alert i want to pass the retuen callback to objective-C code.
Here it is:-
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width = device-width, initial-scale = 1.0, maximum-scale = 1.0, minimum-scale = 1.0, user-scalable=no"/>
<meta name="HandheldFriendly" content="True"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>Test HTML</title>
<script type="text/javascript">
function open(url, offset){
alert("Open Webview with url:"+ url + " & Offset: " + offset);
}
function close(url, offset){
alert("close webview");
}
</script>
</head>
<body>
Open<br>
Close
</body>
</html>
I used webviewjavascriptbridge to communicate javascript and objective C code.
In this example code, note the global variable of bridge.
<!doctype html>
<html><head>
<style type='text/css'>
html { font-family:Helvetica; color:#222; }
h1 { color:steelblue; font-size:24px; margin-top:24px; }
button { margin:0 3px 10px; font-size:12px; }
.logLine { border-bottom:1px solid #ccc; padding:4px 2px; font-family:courier; font-size:11px; }
</style>
</head><body>
<h1>WebViewJavascriptBridge Demo</h1>
<script>
window.onerror = function(err) {
alert('window.onerror: ' + err)
}
var bridge;
document.addEventListener('WebViewJavascriptBridgeReady', onBridgeReady, false)
function onBridgeReady(event){
alert("Onbridge ready call");
bridge = event.bridge
var uniqueId = 1
function log(message, data) {
var log = document.getElementById('log')
var el = document.createElement('div')
el.className = 'logLine'
el.innerHTML = uniqueId++ + '. ' + message + (data ? ': ' + JSON.stringify(data) : '')
if (log.children.length) { log.insertBefore(el, log.children[0]) }
else { log.appendChild(el) }
}
bridge.init(function(message) {
log('JS got a message', message)
})
bridge.registerHandler('open', function(data, response) {
log('JS handler testJavascriptHandler was called', data)
response.respondWith({ 'Javascript Says':'open open open!' })
})
bridge.registerHandler('testJavascriptHandler', function(data, response) {
log('JS handler testJavascriptHandler was called', data)
response.respondWith({ 'Javascript Says':'Right back atcha!' })
})
var button = document.getElementById('buttons').appendChild(document.createElement('button'))
button.innerHTML = 'Send message to ObjC'
button.ontouchstart = function(e) {
e.preventDefault()
bridge.send('Hello from JS button')
}
document.body.appendChild(document.createElement('br'))
var callbackButton = document.getElementById('buttons').appendChild(document.createElement('button'))
callbackButton.innerHTML = 'Fire testObjcCallback'
callbackButton.ontouchstart = function(e) {
e.preventDefault()
log("Calling handler testObjcCallback")
bridge.callHandler('testObjcCallback', {'foo': 'bar'}, function(response) {
log('Got response from testObjcCallback', response)
})
}
}
function open(url, offset,e)
{
alert(bridge);
//alert("Open Webview with url:Yes Got it");
// alert(document.getElementById(offset).href);
// var bridge = event.bridge;
// alert(bridge);
window.location = url+'?offset='+offset//'myapp:myaction:url:offset'
//requestFromObjc("buttonColor&someParam=1");
}
function close()
{
alert("Open Webview with url:"+ url + " & Offset: " + offset);
}
function requestFromObjc(functionName, objcResult, callback)
{
if (!objcResult)
{
window.location = 'myapp:myaction:param1:param2'
// window.location = "myapp://objcRequest?function=" + functionName + "&callback=" + arguments.callee.name + "&callbackFunc=" + arguments.callee.caller.name;
}
else
{
window[callback](objcResult);
}
}
</script>
<div id='buttons'></div> <div id='log'></div>
<body>
<a id="55" href="javascript:open('http://www.tcm.com', '55',this)">Open</a><br>
Close
</body>
</body></html>
Reference: https://github.com/marcuswestin/WebViewJavascriptBridge
You can communicate with your HTML from objective c with the following webView delagate methods...
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
Please go through the usage of these methods...
I hope this may help you
The HTML file has 4 buttons that record, stop recording the voice, and play, stop playing it. the code looks like this.
<!DOCTYPE HTML>
<html>
<head>
<title>Cordova</title>
<script type="text/javascript" charset="utf-8" src="scripts/cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="scripts/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function(){
$("#record").on("click", function(){
alert("record start");
window.plugins.VoicePlugin.record(function(){alert("yo");},
function(){alert("yol");},
"voice.3gp");
});
$("#stoprecord").on('click', function(){
alert("record stop");
window.plugins.VoicePlugin.stoprecord(function(){},
function(){},
"voice.3pg");
});
$("#play").on("click", function(){
alert("play");
window.plugins.VoicePlugin.play(function(){},
function(){},
"voice.3pg");
});
$("#stopplay").on("click", function(){
alert("stop play");
window.plugins.VoicePlugin.stopplay(function(){},
function(){},
"voice.3pg");
});
});
</script>
</head>
<body>
<button id="record">Start Recording</button>
<button id="stoprecord">Stop Recording</button>
<button id="play">Start Playing</button>
<button id="stopplay">Stop Playing</button>
</body>
</html>
The Android Plugin part is
package com.saxoo.voice;
import java.io.IOException;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import org.json.JSONArray;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.util.Log;
/**
* #author sbapp008
*
*/
public class VoicePlugin extends Plugin {
/* (non-Javadoc)
* #see org.apache.cordova.api.Plugin#execute(java.lang.String, org.json.JSONArray, java.lang.String)
*/
public static final String Record = "record";
public static final String Play = "play";
public static final String Stopplaying = "stopplaying";
public static final String Stoprecording = "stoprecording";
private static final String LOG_TAG = "AudioRecordTest";
private static String mFileName = null;
private static MediaRecorder mRecorder = null;
private static MediaPlayer mPlayer = null;
#Override
public PluginResult execute(String action, JSONArray data, String callbackId) {
PluginResult result = null;
if(Record.equals(action)){ //data에 filename
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
mRecorder.prepare();
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
mRecorder.start();
} else if(Play.equals(action)){ //data에 filename
mPlayer = new MediaPlayer();
try {
mPlayer.setDataSource(mFileName);
mPlayer.prepare();
mPlayer.start();
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
} else if(Stopplaying.equals(action)){
mPlayer.release();
mPlayer = null;
} else{
mRecorder.stop();
mRecorder.release();
mRecorder = null;
}
return null;
}
}
The point is, i should stay in an Activity that record, stop recording, play and stop playing the voice. If I use phonegap, since it just send some strings via plugin, the MediaRecorder and MediaPlayer object is created and destroyed each time. I push the record button which is in html, the MediaRecorder object is created, but pushing the stop recording button cannot stop the MediaRecorder object that is just created. Is there any solution for this problem?
With Phonegap I record voice and play recording voice without addition plugins.
I only conect plugin of Phonegap Media to my app like this:
app/res/xml/config.xml
<plugin name="Media" value="org.apache.cordova.AudioHandler" />
app/AndroidManifest.xml
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Code there:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">
<script type="text/javascript" charset="utf-8" src="cordova-2.2.0.js"></script>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
var deviceready = false;
var mediaVar = null;
var recordFileName = "recording.wav";
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
deviceready = true;
}
$(document).ready(function(){
//validation to check if device is ready is skipped
$("#recordBtn").click(function(){
record();
});
$("#playBtn").click(function(){
play();
});
$("#stopBtn").click(function(){
stop();
});
});
function record()
{
if (mediaVar != null) {
mediaVar.release();
}
createMedia(function(){
status = "recording";
mediaVar.startRecord();
},onStatusChange);
}
function createMedia(onMediaCreated, mediaStatusCallback){
if (mediaVar != null) {
onMediaCreated();
return;
}
if (typeof mediaStatusCallback == 'undefined')
mediaStatusCallback = null;
mediaVar = new Media(recordFileName, function(){
log("Media created successfully");
}, onError, mediaStatusCallback);
onMediaCreated();
}
function stop()
{
if (mediaVar == null)
return;
if (status == 'recording')
{
mediaVar.stopRecord();
log("Recording stopped");
}
else if (status == 'playing')
{
mediaVar.stop();
log("Play stopped");
}
else
{
log("Nothing stopped");
}
status = 'stopped';
}
function play()
{
createMedia(function(){
status = "playing";
mediaVar = new Media('/sdcard/'+recordFileName, function(){
log("Media created successfully");
}, onError);
mediaVar.play();
});
}
function onStatusChange()
{
}
function onSuccess()
{
//do nothing
}
function onError(err)
{
if (typeof err.message != 'undefined')
err = err.message;
alert("Error : " + err);
}
function log(message)
{
console.info(message);
}
</script>
</head>
<body onload="onBodyLoad()">
Recorder<br>
<input type="button" name="recordBtn" id="recordBtn" value="Record">
<input type="button" name="stopBtn" id="stopBtn" value="Stop">
<input type="button" name="playBtn" id="playBtn" value="Play">
</body>
</html>
On Android devices, the PhoneGap media object has the following important behaviors that are not well documented (http://software.intel.com/en-us/articles/media-sample-using-phonegap#id_android):
"my_audio = new Media('myRecording100.wav', onMediaCallSuccess,
onMediaCallError)": when "myRecording100.wav" does not exist, it
will create the file; when it exists, it opens it.
"my_audio.stopRecord()": when "stopRecord()" is called, the .wav
media file is moved to "/sdcard" folder. So when checking if previous
recorded .wav exists, the code should look under "/sdcard" folder. If
it does exist, it should open the file from
"/sdcard/myRecording100.wav".
Hope this helps you.