android services skill sprint
TRANSCRIPT
![Page 1: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/1.jpg)
embt.co/sprint-android-servicesBlogNotes:
Android Servicesfor Background Execution
Developer Skill SprintTips, Tricks and Techniques
The Ultimate Application Development platform forWidows 10, Mac, Mobile and IoT
Jim McKeethDeveloper Evangelist / EngineerEmbarcadero [email protected]
Nov10th,2015
@JimMcKeeth
![Page 2: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/2.jpg)
embt.co/sprint-android-servicesBlogNotes:
This Skill Sprint Works with . . .
• Windows• OS X• Android• iOS• RAD Studio• Appmethod• Object Pascal• C++
• RAD Studio 10 Seattle DocWiki– http://docwiki.embarcadero.com/RADStudio/Seattle/en/
• Appmethod Summer 2015 Release DocWiki– http://docwiki.appmethod.com/appmethod/1.17/topics/en/
• Appmethod supports the FireMonkey framework on all four platforms while RAD Studio, Delphi and C++Builder also support VCL on Windows. Contact sales with any questions!
![Page 3: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/3.jpg)
embt.co/sprint-android-servicesBlogNotes:
Agenda
• What are Android Services• Services vs. Threads• Types of Services• Android Service Wizard• Demonstrations• More Information
![Page 4: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/4.jpg)
embt.co/sprint-android-servicesBlogNotes:
Why Android Services?
• Provide background functionality• Can run even when app is closed• Can start on boot or on other events• Can be accessible by multiple apps• Can contain multiple threads
![Page 5: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/5.jpg)
embt.co/sprint-android-servicesBlogNotes:
Android Services vs. Threads
Android Services• Cannot access the UI• Runs in main thread of
host app process• Can contain multiple
threads• Used for long running
processes
Threads• Cannot access the UI• Not accessible to other
apps• Terminated with app• Used to improve
responsiveness
![Page 6: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/6.jpg)
embt.co/sprint-android-servicesBlogNotes:
Android Service Type Variations
• IntentService– Handle asynchronous requests (onHandleIntent(Intent) event)
– Otherwise are syncronous (onStartCommand(Intent) event)
– Both are Bindable (onBind event)
• Local vs. Remote– Local only accessible by host (exported = false in manifest)
– Remote cross app access (exported = true in manifest)
![Page 7: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/7.jpg)
embt.co/sprint-android-servicesBlogNotes:
Android Service Wizard
• Local Service– Synchronous local access
• Intent Local Service– Asynchronous local access
• Remote Service– Synchronous local & remote access
• Intent Remote Service– Asynchronous local & remote access
![Page 8: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/8.jpg)
embt.co/sprint-android-servicesBlogNotes:
Demonstration
Downloadafreetrial!embt.co/trialdownloads
![Page 9: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/9.jpg)
embt.co/sprint-android-servicesBlogNotes:
Restrictions for Services
• Cannot Access UI• Not use components from the FMX namespace• Be aware of power consumption
– Using a lot of CPU– Using network connection
• Respect users expectations and privacy
![Page 10: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/10.jpg)
embt.co/sprint-android-servicesBlogNotes:
Service Workarounds
• Use RTL or low-level calls instead of FMX components. If the service fails when started, use a lower level call.
• Manually edit manifest to make remote services published.
• Manually edit Java Templates for Intent and Remote Services (See http://delphi.org/?p=2084)
![Page 11: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/11.jpg)
embt.co/sprint-android-servicesBlogNotes:
Learning Resources
• DocWiki– http://docwiki.embarcadero.com/RADStudio/Seattle/en/Android_Service– http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_Android_Services
• CodeRage X – Android Services on YouTube– http://embt.co/crx-android-services
• Blog Posts– http://delphi.org/tag/android-services/– http://community.embarcadero.com/blogs/entry/download-an-image-in-background-
with-android-services
Downloadafreetrial!embt.co/trialdownloads
![Page 12: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/12.jpg)
embt.co/sprint-android-servicesBlogNotes:
Next Time . . .
GPU Computing with OpenCLSee the full schedule and replays at embt.co/Sprints15
• Tuesday, the 17th of November, 2014– 6AM San Francisco / 9AM New York / 2PM London / 3PM Milan– 11AM San Francisco / 2PM New York / 7PM London / 8PM Milan– 5PM San Francisco / Wed 10AM Tokyo / Wed 12PM Sydney(Based on San Francisco time. Verify your local time are correct: http://embt.co/nov17thtimes)
Downloadafreetrial!embt.co/trialdownloads
![Page 13: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/13.jpg)
embt.co/sprint-android-servicesBlogNotes:
See the special offersembt.co/try-rad-studio
![Page 14: Android Services Skill Sprint](https://reader034.vdocuments.us/reader034/viewer/2022050614/5889fac71a28ab0f388b5635/html5/thumbnails/14.jpg)
embt.co/sprint-android-servicesBlogNotes:
Q&A
Developer Skill SprintTips, Tricks and Techniques
The Ultimate Application Development platform forWidows 10, Mac, Mobile and IoT
Jim McKeethDeveloper Evangelist / EngineerEmbarcadero [email protected]
November10th,2015
@JimMcKeeth
Thank-You!
Downloadafreetrial!embt.co/trialdownloads