+1 404-214-5804
Enterprise Mobility Blog, Mobile App Development

Interfacing Mobile Apps with Device Functions: Answering a Location Services Prompt

In a prior post, we showed how to use Mobile Labs’ deviceConnect and UFT 11.5 to create a script that answers a phone call (to be sure the app resumes as expected when the call ends) and to create a script that makes an outgoing phone call.

The small script below shows how UFT 11.5 and deviceConnect can be used to detect and respond to one of the infamous iOS “location services” prompts.

Here is the script:

Location services script

The app we are testing wants to use location services, and iOS prompts the user with a system-side pop up, shown below:

Use current location screen

The script launches the app and waits for three seconds to see if the prompt appears (it only appears the first time the app is run).  If the prompt is detected, the script prints a message on the UFT log and then waits a few seconds (we did this for the benefit of our video recording, below).  It then finds and clicks the “OK” button on the pop-up and issues a message box stating that it performed the task.  If the popup does not appear, the script just presses on with its business.

To enable testing, we used the manual testing console app to reset location and privacy settings:

Privacy settings

This allowed testing the script as many times as we wanted.

Here is a video captured by UFT 11.5 of the script in action:

By: Michael Ryan

Michael Ryan

Michael Ryan serves as Mobile Labs’ chief technology officer. In this role, Ryan provides the technological vision and drives Mobile Labs Trust’s product road map. Ryan has more than 35 years of experience in leading software development teams that design and build robust and market-leading solutions for large-scale enterprise customers among Fortune 1000 companies. Most recently, Ryan was with Fundamental Software where he worked on large-scale systems CPU emulation architecture, design, and implementation. Prior to Fundamental Software, Ryan was director of development, Sr. VP of R&D, and finally, Chief Technical Officer for CASE tool vendor KnowledgeWare, Inc. Ryan served as senior staff systems engineer, field manager, and regional technical support manager for mainframe manufacturer Amdahl Corporation.

More Posts - Website

Leave a Reply

You must be logged in to post a comment.

Why Mobile Labs?

Mobile Labs provides enterprise-grade, next generation mobile application testing tools. With a focus on security, agility and affordability, Mobile Labs delivers solutions to help you deliver quality mobile apps for Android, iOS and Windows platforms while also helping manage mobile devices in a private, secure cloud.

Contact Mobile Labs

3423 Piedmont Road NE
Suite 465
Atlanta, GA 30305
+1 404-214-5804
twitter  facebook linkedin google-plus SlideShare