android services skill sprint
TRANSCRIPT
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
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!
embt.co/sprint-android-servicesBlogNotes:
Agenda
• What are Android Services• Services vs. Threads• Types of Services• Android Service Wizard• Demonstrations• More Information
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
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
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)
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
embt.co/sprint-android-servicesBlogNotes:
Demonstration
Downloadafreetrial!embt.co/trialdownloads
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
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)
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
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
embt.co/sprint-android-servicesBlogNotes:
See the special offersembt.co/try-rad-studio
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