Click here to close now.

Welcome!

API Journal Authors: Carmen Gonzalez, John Wetherill, Liz McMillan, AppDynamics Blog, Vormetric Blog

Blog Feed Post

SureFox Javascript APIs

SureFox for Android now comes with built-in set of Javascript APIs. Use them in a customized SureFox toolbar or embed in your web application to perform variety of actions such as navigating through pages or to launch an app directly from SureFox.

The APIs are written as window.surefox.<API_Name>

Following is a comprehensive list of SureFox APIs:

  • load(URL): Loads the URL in the active screen of SureFox. URL is passed as a parameter to the API
window.surefox.load('http://www.google.com');
  •  openInNewTab(URL): Loads the URL in a new tab of SureFox. URL is passed as a parameter to the API
window.surefox.openInNewTab('http://www.google.com');
  • back(): Navigate to the previous page in SureFox
window.surefox.back();
  • forward(): Navigate to the next page in SureFox
window.surefox.forward();
  • home(): Loads SureFox home page
window.surefox.home();
  • refresh(): Refreshes current web page
window.surefox.refresh();
  • stop(): Stops any ongoing loading activity in SureFox
window.surefox.stop();
  • launch(packagename): Launches the application from SureFox. Only the package name of the application needs to be passed as a parameter to the API.
window.surefox.launch('com.android.contacts');
  • launch(action,category,packagename,classname): Use this to launch a particular activity of an application from SureFox. The action, category, package name and class name of the application need to be passed as parameters to the API.
window.surefox.launch('android.intent.action.MAIN', 'android.intent.category.LAUNCHER', 'com.android.contacts', 'com.android.contacts.activities.PeopleActivity');

You can also use SureFox APIs to get and display battery status and perform actions based on the battery level. Following are the list of SureFox battery APIs:

  • battery().level(): Returns the current battery level
window.surefox.battery().level()
  • battery().charging(): Returns 'true' if battery is charging else returns a 'false'
window.surefox.battery().charging()
  • battery().addEventListener("levelchange", "<user-defined-function>"): Used to add an event listener for battery level which can be used to call any function of your choice
window.surefox.battery().addEventListener("levelchange", "setLevel");
  • battery().addEventListener("chargingchange", "<user-defined-function>"):
window.surefox.battery().addEventListener("chargingchange", "setStatus");

 

Sample HTML page for displaying use of SureFox APIs:

SureFox Javascript API Demo page

SureFox Javascript API Demo page

HTML Code for demo page:

<html>
 <head>
 <title>SureFox Javascript APIs</title>
 <script type="text/javascript">
 function setLevel(value) {
 document.querySelector('#level').textContent = "Battery Level = " + value+"%";
 }
 function setStatus(value) {
 document.querySelector('#status').textContent = "Charging: " + window.surefox.battery().charging();
 }
 function init() {
 setLevel(window.surefox.battery().level() * 100);
 setStatus(window.surefox.battery().charging());
 window.surefox.battery().addEventListener("levelchange", "setLevel");
 window.surefox.battery().addEventListener("chargingchange", "setStatus");
 }
 </script>
 </head>

 <body onload="javascript:init()">

 <div id="container" style="background-color: #cccccc;">
 <div style="float:right;">
 Real Time Battery Status:<div id="status">(charging state unknown)</div>
 <div id="level">(battery level unknown)</div>
 </div>
 <span onclick="window.surefox.home();"><button>Home</button></span>
 <span onclick="window.surefox.back();"><button>Back</button></span>
 <span onclick="window.surefox.forward();"><button>Forward</button></span>
 <span onclick="window.surefox.refresh();"><button>Refresh</button></span>
 <span onclick="window.surefox.stop();"><button>Stop</button></span>
 <span onclick="window.surefox.launch('com.android.calendar');"><button>Calendar</button></span>
 <span onclick="window.surefox.launch('android.intent.action.MAIN', 'android.intent.category.LAUNCHER', 'com.android.vending', 'com.android.vending.AssetBrowserActivity');"><button>Google Play</button></span>
 <br />
 <b><span onclick="window.surefox.load('http://www.42gears.com');">Click to visit 42Gears</span>
 <br />
 <span onclick="window.surefox.openInNewTab('http://www.google.com');">Click to launch Google(Open in new tab)</span></b>
</div>
</body>
 </html>

To know more about SureFox, click here

To learn more on how to secure and manage Android, iOS and Windows Mobile/CE devices efficiently, visit us at www.42gears.com

Read the original blog entry...

More Stories By Onkar Singh

The author is the founder of 42Gears, developer of affordable Mobile Device Management tools.

@ThingsExpo Stories
SYS-CON Events announced today that the "First Containers & Microservices Conference" will take place June 9-11, 2015, at the Javits Center in New York City. The “Second Containers & Microservices Conference” will take place November 3-5, 2015, at Santa Clara Convention Center, Santa Clara, CA. Containers and microservices have become topics of intense interest throughout the cloud developer and enterprise IT communities.
"There is a natural synchronization between the business models, the IoT is there to support ,” explained Brendan O'Brien, Co-founder and Chief Architect of Aria Systems, in this SYS-CON.tv interview at the 15th International Cloud Expo®, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
The 17th International Cloud Expo has announced that its Call for Papers is open. 17th International Cloud Expo, to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, APM, APIs, Microservices, Security, Big Data, Internet of Things, DevOps and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal today!
The 4th International Internet of @ThingsExpo, co-located with the 17th International Cloud Expo - to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA - announces that its Call for Papers is open. The Internet of Things (IoT) is the biggest idea since the creation of the Worldwide Web more than 20 years ago.
The basic integration architecture, as defined by ESBs, hasn’t changed for more than a decade. Most cloud integration providers still rely on an ESB architecture and their proprietary connectors. As a result, enterprise integration projects suffer from constraints of availability and reliability of these connectors that are not re-usable across other integration vendors. However, the rapid adoption of APIs and almost ubiquitous availability of APIs amongst most SaaS and Cloud applications are rapidly redefining traditional integration approaches and their reliance on proprietary connectors. ...
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo in Silicon Valley. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 17th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal an...
Health care systems across the globe are under enormous strain, as facilities reach capacity and costs continue to rise. M2M and the Internet of Things have the potential to transform the industry through connected health solutions that can make care more efficient while reducing costs. In fact, Vodafone's annual M2M Barometer Report forecasts M2M applications rising to 57 percent in health care and life sciences by 2016. Lively is one of Vodafone's health care partners, whose solutions enable older adults to live independent lives while staying connected to loved ones. M2M will continue to gr...
“Connect2Me is basically a game changer in the IoT industry. We have created IoT connecter middleware that can enable a connection to any kind of device," explained Yasser Khan, CTO of Connect2Me, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
17th Cloud Expo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterprises are using some form of XaaS – software, platform, and infrastructure as a service.
“In the past year we've seen a lot of stabilization of WebRTC. You can now use it in production with a far greater degree of certainty. A lot of the real developments in the past year have been in things like the data channel, which will enable a whole new type of application," explained Peter Dunkley, Technical Director at Acision, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that BMC will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. BMC delivers software solutions that help IT transform digital enterprises for the ultimate competitive business advantage. BMC has worked with thousands of leading companies to create and deliver powerful IT management services. From mainframe to cloud to mobile, BMC pairs high-speed digital innovation with robust IT industrialization – allowing customers to provide amazing user experiences with optimized IT per...
SYS-CON Events announced today that the "First Containers & Microservices Conference" will take place June 9-11, 2015, at the Javits Center in New York City. The “Second Containers & Microservices Conference” will take place November 3-5, 2015, at Santa Clara Convention Center, Santa Clara, CA. Containers and microservices have become topics of intense interest throughout the cloud developer and enterprise IT communities.
ThingsExpo New York is offering a limited time FREE "Expo Plus" registration option in New York. On site registration price of $1,95 will be set to 'free' for delegates who register during special offer. To take advantage of this opportunity, attendees can use the coupon code, and secure their registration to attend all keynotes, ThingsExpo sessions, expo floor, and SYS-CON.tv power panels. Special FREE registration givess access to all DevOps, Containers and Microservices sessions as well. Registration page is located at the ThingsExpo site.
The only place to be Nov 3-5 is Cloud Expo | @ThingsExpo | DevOps Summit 2015 West at the Santa Clara Convention Center in Santa Clara, CA. Join us there as delegates from all over the world come to listen to and engage with speakers & sponsors from the leading Cloud Computing, IoT, Big Data and DevOps companies. Cloud Expo & @ThingsExpo are the leading events covering the booming market of Cloud Computing, IoT & Big Data for the enterprise. Speakers from all over the world will be hand-picked for their ability to explore the economic strategies that utility/cloud computing provides. Whether...
DevOps Summit at Cloud Expo New York is offering a limited time FREE "Expo Plus" registration option in New York. On site registration price of $1,95 will be set to 'free' for delegates who register during special offer. To take advantage of this opportunity, attendees can use the coupon code, and secure their registration to attend all keynotes, @DevOpsSummit sessions at Cloud Expo, expo floor, and SYS-CON.tv power panels. Special FREE registration givess access to all Containers and Microservices sessions. Registration page is located at the DevOps Summit site. Your DevOps Summit registratio...
Akana, a leading provider of API Management, API Security and Cloud Integration solutions, announced that it is introducing DevOps automation to the API lifecycle. New capabilities in Akana's API Management platform significantly reduce the time required to update API definitions and versions. DevOps teams will be able to work faster in designing and developing APIs, as well as managing them at runtime and publishing them to a portal.
Growth hacking is common for startups to make unheard-of progress in building their business. Career Hacks can help Geek Girls and those who support them (yes, that's you too, Dad!) to excel in this typically male-dominated world. Get ready to learn the facts: Is there a bias against women in the tech / developer communities? Why are women 50% of the workforce, but hold only 24% of the STEM or IT positions? Some beginnings of what to do about it!
Imagine a world where targeting, attribution, and analytics are just as intrinsic to the physical world as they currently are to display advertising. Advances in technologies and changes in consumer behavior have opened the door to a whole new category of personalized marketing experience based on direct interactions with products. The products themselves now have a voice. What will they say? Who will control it? And what does it take for brands to win in this new world? In his session at @ThingsExpo, Zack Bennett, Vice President of Customer Success at EVRYTHNG, will answer these questions a...
"People are a lot more knowledgeable about APIs now. There are two types of people who work with APIs - IT people who want to use APIs for something internal and the product managers who want to do something outside APIs for people to connect to them," explained Roberto Medrano, Executive Vice President at SOA Software, in this SYS-CON.tv interview at Cloud Expo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
2015 predictions circa 1970: houses anticipate our needs and adapt, city infrastructure is citizen and situation aware, office buildings identify and preprocess you. Today smart buildings have no such collective conscience, no shared set of fundamental services to identify, predict and synchronize around us. LiveSpace and M2Mi are changing that. LiveSpace Smart Environment devices deliver over the M2Mi IoT Platform real time presence, awareness and intent analytics as a service to local connected devices. In her session at @ThingsExpo, Sarah Cooper, VP Business of Development at M2Mi, will d...