Technische Ondersteuning Psychologie __________________________________________________________________________________ Presentation Mobile: experiments on Android and iOS by Elisabeth Nieuwburg Last updated: June 2017 TABLE OF CONTENTS 1. INTRODUCTION ……………………………………………………………………… 2 2. TOUCH ……………………………………………………………………………… . … 2 3. TEST MO DE ………………………………………………………………………… .... 5 4. PACKAGING EXPERIMENTS ……………………………………………………… .. 5 5. HOSTING EXPERIMENTS ………………………………………………………… .... 6 7. DOWNLOADING EXPERIMENTS IN THE APP ………………………………… . …. 6 8. OUTPUT ……………………………………………………………………………… .. 6 9. RESTRICTIONS FOR CROSS-PLATFORM EXPERIMENTS ……………………… 7 10. ADAPTING A WINDOWS TASK FOR MOBILE USE: TIPS AND TRICKS …...… 7 APPENDIX I: EXAMPLE SCENARIO FILE …………………………………………... .. 9 APPENDIX II: EXAMPLE SCENARIO FILE ……………………………………..… ..... 11 1
Technische Ondersteuning Psychologie __________________________________________________________________________________ 1. INTRODUCTION In 2016, the stimulus delivery and experiment control program Presentation introduced Presentation Mobile: the possibility to run experiments on Android and iOS devices. In addition to Presentation’s documentation on mobile experiments 1,2 , this document provides a quick introduction to Presentation Mobile for the novice user. After programming an experiment in Presentation for Windows, it can be run on the freely available Presentation Mobile app 3 . Please note that in order to design an experiment with touch responses, Windows 8 or higher is needed. Also make sure the latest version of Presentation is installed. There are a few important things to keep in mind while designing an experiment for mobile use. Firstly, the experiment settings and scenario file need to be adapted to touch screen properties. Intermediate versions of the experiment can be tested without a license, but once the experiment is finished it should be packaged for hosting on the NBS website, in order to remove the test mode watermark. The experiment needs to be downloaded in the mobile app and output can be transferred to a computer. Importantly, mobile experiments have restrictions as compared to Windows experiments. All these issues, as well as some tips and tricks to adapt a task for mobile use will be discussed below. 2. TOUCH Experiment settings A task that requires a mouse device when run on a Windows device does not automatically work on a touch-based mobile device. To use touch in an experiment, the pointing device should be selected in the response settings of the experiment. This is done by selecting Settings tab > Response Panel > Pointing Device > Use Mouse. Also, at least one active button needs to be specified (most likely the Pointer Down button and optionally other Pointing Device buttons as well). 1 https://www.neurobs.com/menu_presentation/menu_features/mobile_docs 2 https://www.neurobs.com/pres_docs/html/03_presentation/15_creating_mobile_experiments.htm 3 Available for Android (https://play.google.com/store/apps/details?id=com.neurobs.presentation) and iOS (available from the App Store) 2
Technische Ondersteuning Psychologie __________________________________________________________________________________ Figure 1. Properties of the Pointing Device. In the properties of the pointing device (see Figure 1) ‘touch buttons’ can be specified, that can be used as active response buttons in your scenario. Each touch button (e.g. pointer down) has a from and a to specification, with the states ‘up’ (not touching the screen), ‘hover’ (almost touching the screen, used for a stylus), and ‘down’ (touching the screen). These from and to settings describe one transition from one state to another. Also note the two drop-down boxes, that can be used to select all states ‘higher than’ or ‘lower or equal to’ a certain state . As an example, to generate one button response when the screen is touched , ‘up’ and ‘hover’ can be ticked for from , and ‘down’ for to , meaning that one response is generated by moving from a state where the screen is not touched, to a state where the screen is touched. Using the drop-down boxes, the same result can be achieved by selecting ‘states higher than down’ for from and selectin g ‘states lower or equal to down’ for to. Edges can be defined to restrict the area to which each touch button is responsive. It is recommended to specify this in ‘custom units’ rather than pixels, because of the variability in size of mobile devices. The settings of the touch buttons can be tested using the ‘test button’ function. A very useful feature is the mouse test mode , which enables you to test the touch functions on a non- touch screen using the computer mouse. This setting is not saved in the experiment file and needs to be ticked every time the experiment is opened. 3
Technische Ondersteuning Psychologie __________________________________________________________________________________ Scenario file Just like any other button presses, touch button presses result in response_data objects in the response_manager . For example, the amount of touch responses can be accessed by entering: response_manager.total_response_count(1) The touch_response conversion function can be used to obtain a touch_response data object (a child type of the response_data object maintained by the response_manager) and can be treated like other response_data objects. touch_response touch = touch_response(response_manager.last_response_data() ); The touch_response object can for example be used to obtain the location of the touch down event by applying the functions x( ) and y( ). term.print(touch.x()); term.print(touch.y()); Instead of obtaining touch_responses from the response_manager, the touch_device conversion function can be used to convert the mouse object associated with the response_manager to a touch_device (a child type of the mouse object). touch_device tdevice = touch_device( response_manager.get_mouse(1) ); The touch_device provides access to touch_interaction objects, the basic units of a touch event, it represents a single complete swipe, from touch-down to touch-up, including the complete trajectory of the finger/stylus while it was down, with information on location and associated timestamps. Touch_interactions can be accessed by applying the get_interaction function to the touch_device. This function requires the index of the touch_interaction as an argument. touch_interaction ti = tdevice.get_interaction(i); At the lowest level, touch_interactions are build up from touch_samples, with their own time and x and y values. To access a touch_sample , the get_sample function can be applied to a touch interaction. This function also requires the touch_sample index as an argument. touch_sample ts = ti.get_sample(i); Also, the sample_count function can be used to obtain the number of touch_samples in an interaction. term.print(ti.sample_count()); In the case of multitouch, multiple touch_interactions are active at the same time. Once an interaction has ended (i.e. the last sample has the ‘up’ state), the active property of the touch_interaction becomes false: if (ti.active()) then t erm.print(“active”) ; 4
Recommend
More recommend