SlideShare une entreprise Scribd logo
1  sur  8
Télécharger pour lire hors ligne
How to test GPS
on Emulator
potatotips #20
Problems to solve
• Execute test code effectively
• Android public emulator does not support
GPS sensors
Genymotion
• Fast
• x86 archirecture, VirtualBox
• Simple
• Some behavior with Android Public Emulator
• Powerfull
• Contro some sensor from API
Configuring Gradle Builds
repositories {
maven{
url "http://api.genymotion.com/repositories/releases/"
}
}
dependencies {
androidTestCompile ‘com.genymotion.api:genymotion-api:1.0.2’
}
How to use (GPS Sensors)
GenymotionManager genymotion =
GenymotionManager.getGenymotionManager(ctx);
// Position to reykjavik (257km away))
Log.d(GpsSampleFragment.TAG, "Force position to Reykjavik");
genymotion.getGps()
.setLatitude(64.13367829)
.setLongitude(-21.8964386);
// Then ensure warning is hidden
Assert.assertEquals(tvWarning.getVisibility(), View.GONE);
// Position near Dalvik
Log.d(GpsSampleFragment.TAG, "Force position near Dalvik");
genymotion.getGps()
.setLatitude(65.9446)
.setLongitude(-18.35744619);
// Ensure warning is shown
Assert.assertEquals(tvWarning.getVisibility(), View.VISIBLE);
How to use (Battery Status)
GenymotionManager genymotion =
GenymotionManager.getGenymotionManager(getActivity());
// Change battery level and charging status
Log.d(BatterySampleFragment.TAG, "Force full battery + charging");
genymotion.getBattery()
.setLevel(100)
.setStatus(Battery.Status.CHARGING);
// Then ensure warning is hidden
Assert.assertEquals(tvWarning.getVisibility(), View.GONE);
// Change battery level and charging status
Log.d(BatterySampleFragment.TAG, "Force low battery");
genymotion.getBattery()
.setLevel(3)
.setStatus(Battery.Status.DISCHARGING);
// Then ensure warning is visible
Assert.assertEquals(tvWarning.getVisibility(), View.VISIBLE);
// set battery mode back to HOST
genymotion.getBattery().setMode(Battery.Mode.HOST);
Excursus
• Need to login
• Free
• For personal use only
• Business
• €24.99, per month,per user
• Java API
• need to emulate sensors
Thank you

Contenu connexe

En vedette

React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigiReact Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
Yukiya Nakagawa
 

En vedette (14)

just one line
just one linejust one line
just one line
 
watchOS1 to watchOS2
watchOS1 to watchOS2watchOS1 to watchOS2
watchOS1 to watchOS2
 
Android Mのruntime-permissionに潜む罠
Android Mのruntime-permissionに潜む罠Android Mのruntime-permissionに潜む罠
Android Mのruntime-permissionに潜む罠
 
とにかく明るいCore Spotlight
とにかく明るいCore Spotlightとにかく明るいCore Spotlight
とにかく明るいCore Spotlight
 
PUSH通知証明書作成ツールを作った
PUSH通知証明書作成ツールを作ったPUSH通知証明書作成ツールを作った
PUSH通知証明書作成ツールを作った
 
Command Line Tool in swift
Command Line Tool in swiftCommand Line Tool in swift
Command Line Tool in swift
 
Leak canaryで メモリリーク調査
Leak canaryで メモリリーク調査Leak canaryで メモリリーク調査
Leak canaryで メモリリーク調査
 
実践アニメーション
実践アニメーション実践アニメーション
実践アニメーション
 
Android lint-srp-practice
Android lint-srp-practiceAndroid lint-srp-practice
Android lint-srp-practice
 
What is tested by pre-launch (security) reports?
What is tested by pre-launch (security) reports?What is tested by pre-launch (security) reports?
What is tested by pre-launch (security) reports?
 
全てSになる -RxJavaとLWSを持ち込む楽しさ-
全てSになる -RxJavaとLWSを持ち込む楽しさ-全てSになる -RxJavaとLWSを持ち込む楽しさ-
全てSになる -RxJavaとLWSを持ち込む楽しさ-
 
Androidアプリのストレージ戦略
Androidアプリのストレージ戦略Androidアプリのストレージ戦略
Androidアプリのストレージ戦略
 
minneにおけるテスト〜リリース〜リリース後にやっている事の紹介
minneにおけるテスト〜リリース〜リリース後にやっている事の紹介minneにおけるテスト〜リリース〜リリース後にやっている事の紹介
minneにおけるテスト〜リリース〜リリース後にやっている事の紹介
 
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigiReact Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
 

Similaire à 20150811 potatotips 20

Google Developer Fest 2010
Google Developer Fest 2010Google Developer Fest 2010
Google Developer Fest 2010
Chris Ramsdale
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKit
Ariya Hidayat
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 

Similaire à 20150811 potatotips 20 (20)

OpenCensus with Prometheus and Kubernetes
OpenCensus with Prometheus and KubernetesOpenCensus with Prometheus and Kubernetes
OpenCensus with Prometheus and Kubernetes
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, BerlinAbgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
 
JBoss World 2010
JBoss World 2010JBoss World 2010
JBoss World 2010
 
Google Developer Fest 2010
Google Developer Fest 2010Google Developer Fest 2010
Google Developer Fest 2010
 
Opencensus with prometheus and kubernetes
Opencensus with prometheus and kubernetesOpencensus with prometheus and kubernetes
Opencensus with prometheus and kubernetes
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Will it blend? Java agents and OSGi
Will it blend? Java agents and OSGiWill it blend? Java agents and OSGi
Will it blend? Java agents and OSGi
 
jQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapjQuery Mobile & PhoneGap
jQuery Mobile & PhoneGap
 
Augmented Reality on iPhone Applications
Augmented Reality on iPhone ApplicationsAugmented Reality on iPhone Applications
Augmented Reality on iPhone Applications
 
Augmented reality
Augmented realityAugmented reality
Augmented reality
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App Engine
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App Engine
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKit
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
Genymotion with Jenkins
Genymotion with JenkinsGenymotion with Jenkins
Genymotion with Jenkins
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 

Plus de tkawashita (9)

DevRelMeetup Tokyo #36 技術書典5 参加報告
DevRelMeetup Tokyo #36 技術書典5 参加報告DevRelMeetup Tokyo #36 技術書典5 参加報告
DevRelMeetup Tokyo #36 技術書典5 参加報告
 
DroidKaigi2016 windows環境での効率的なアプリ開発手法
DroidKaigi2016 windows環境での効率的なアプリ開発手法DroidKaigi2016 windows環境での効率的なアプリ開発手法
DroidKaigi2016 windows環境での効率的なアプリ開発手法
 
20150916 potatotips 21_public
20150916 potatotips 21_public20150916 potatotips 21_public
20150916 potatotips 21_public
 
201401217 potatotips no12-for_slideshare_english
201401217 potatotips no12-for_slideshare_english201401217 potatotips no12-for_slideshare_english
201401217 potatotips no12-for_slideshare_english
 
201401217 potatotips No12
201401217 potatotips No12201401217 potatotips No12
201401217 potatotips No12
 
20140312 potatotips no5
20140312 potatotips no520140312 potatotips no5
20140312 potatotips no5
 
20140115 potato tips No.3 Android App Test Development Driven and Jenkins CI ...
20140115 potato tips No.3 Android App Test Development Driven and Jenkins CI ...20140115 potato tips No.3 Android App Test Development Driven and Jenkins CI ...
20140115 potato tips No.3 Android App Test Development Driven and Jenkins CI ...
 
20110813 andeb10資料
20110813 andeb10資料20110813 andeb10資料
20110813 andeb10資料
 
Iosched読書会向け資料
Iosched読書会向け資料Iosched読書会向け資料
Iosched読書会向け資料
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Dernier (20)

Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

20150811 potatotips 20

  • 1. How to test GPS on Emulator potatotips #20
  • 2. Problems to solve • Execute test code effectively • Android public emulator does not support GPS sensors
  • 3. Genymotion • Fast • x86 archirecture, VirtualBox • Simple • Some behavior with Android Public Emulator • Powerfull • Contro some sensor from API
  • 4. Configuring Gradle Builds repositories { maven{ url "http://api.genymotion.com/repositories/releases/" } } dependencies { androidTestCompile ‘com.genymotion.api:genymotion-api:1.0.2’ }
  • 5. How to use (GPS Sensors) GenymotionManager genymotion = GenymotionManager.getGenymotionManager(ctx); // Position to reykjavik (257km away)) Log.d(GpsSampleFragment.TAG, "Force position to Reykjavik"); genymotion.getGps() .setLatitude(64.13367829) .setLongitude(-21.8964386); // Then ensure warning is hidden Assert.assertEquals(tvWarning.getVisibility(), View.GONE); // Position near Dalvik Log.d(GpsSampleFragment.TAG, "Force position near Dalvik"); genymotion.getGps() .setLatitude(65.9446) .setLongitude(-18.35744619); // Ensure warning is shown Assert.assertEquals(tvWarning.getVisibility(), View.VISIBLE);
  • 6. How to use (Battery Status) GenymotionManager genymotion = GenymotionManager.getGenymotionManager(getActivity()); // Change battery level and charging status Log.d(BatterySampleFragment.TAG, "Force full battery + charging"); genymotion.getBattery() .setLevel(100) .setStatus(Battery.Status.CHARGING); // Then ensure warning is hidden Assert.assertEquals(tvWarning.getVisibility(), View.GONE); // Change battery level and charging status Log.d(BatterySampleFragment.TAG, "Force low battery"); genymotion.getBattery() .setLevel(3) .setStatus(Battery.Status.DISCHARGING); // Then ensure warning is visible Assert.assertEquals(tvWarning.getVisibility(), View.VISIBLE); // set battery mode back to HOST genymotion.getBattery().setMode(Battery.Mode.HOST);
  • 7. Excursus • Need to login • Free • For personal use only • Business • €24.99, per month,per user • Java API • need to emulate sensors