Differences

This shows you the differences between two versions of the page.

Link to this comparison view

smd:laboratoare:03 [2021/04/01 16:41]
adriana.draghici
smd:laboratoare:03 [2021/04/08 16:57] (current)
adriana.draghici [Using Intent Services]
Line 83: Line 83:
  
 ====Start a service==== ====Start a service====
 +
  
 <code java> <code java>
Line 113: Line 114:
 } }
 </​code>​ </​code>​
 +
 +:!: If your project is configured for versions higher than Oreo, there'​s no need to perform the check for Oreo.
 +
  
 ====Start foreground service==== ====Start foreground service====
-  * Create a persistent notification (see [[https://proandroiddev.com/deep-dive-into-android-services-4830b8c9a09|example]])+  * Examples: ​[[https://developer.android.com/guide/​components/​foreground-services#​java|documentation]],​ [[https://​androidwave.com/​foreground-service-android-example/|tutorial]] 
 +  * Create a persistent notification like in the links provided above.
   * Call ''​startForeground''​   * Call ''​startForeground''​
  
Line 223: Line 228:
   * If we want to send a response from the IntentService to the activity, we can broadcast the result using intents and register a broadcast receiver for them.   * If we want to send a response from the IntentService to the activity, we can broadcast the result using intents and register a broadcast receiver for them.
  
 +
 +/*
 +TODO INTENT SERVICE IS DEPRECATED, LEAVE THE TEXT< ADD A WARNING AND REMOVE THE EXERCISE
 +*/
 === Task 3 LuckyIntentService (2p) === === Task 3 LuckyIntentService (2p) ===
  
smd/laboratoare/03.1617284492.txt.gz · Last modified: 2021/04/01 16:41 by adriana.draghici
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0