Accessing Device Function using Java Script

  • Create MAF Application.
  • Create Feature “SendMail” and Set ContentType=”LocalHTML”
  • Paste below code to HTML File.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″/>
<title>sendmail</title>
<script type=”text/javascript”>
if(!window.adf) window.adf = {}; adf.wwwPath = “../../../../www/”;
</script>
<script type=”text/javascript” src=”../../../../www/js/base.js”></script>
<script type=”text/javascript” src=”../../../../www/js/cordova-2.2.0.js”></script>
<script type=”text/javascript”>
function sendSMS(){
adf.mf.api.sendSMS({to:”9999999999″, body:”Confirmation sent!”});
}
</script>
</head>
<body><button onClick=”sendSMS()”>Send SMS</button></body>
</html>

Make sure SMS plug-in for the application is enabled. If not, Open maf-application.xml and enable it.

 

enjoy!

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s