Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Wake Up


Published on

Presentation made on the event Barcelona iOS developers by Nigel Grange

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Wake Up

  1. 1. Nigel  Grange  
  2. 2. ¡  Streaming  radio  alarm  clock  app  ¡  Simple  app  but  with  technical  challenges  for  iOS  ¡  High  level  of  design  
  3. 3. ¡  Layout  and  animations  designed  in  Adobe  Edge  Animate  ¡  HTML5  +  CSS3  animation  tool  (Free!)    
  4. 4. ¡  Triggering  alarm  in  background  ¡  Recreating  CSS3  animations  using  Core  Animation  §  Movements,  shadows,  opacity  
  5. 5. ¡  Easy  to  play  radio  stream  in  background  –  as  long  as  it  has  been  started  while  the  application  is  in  foreground  §  Background  processing  thread  §  GPS  location  §  Voice  over  IP  ¡  Use  info.plist  to  set  ‘Required  background  modes’  
  6. 6. ¡  Can  be  used  to  run  for  up  to  10  minutes  when  app  goes  into  background  ¡  Expiration  handler  gets  called  if  task  does  not  end  itself  within  allowed  time    ¡  If  expiration  handler  doesn’t  end  task,  process  is  killed!    bgTask  =  [application  beginBackgroundTaskWithExpirationHandler:^{                  [application  endBackgroundTask:bgTask];                  bgTask  =  UIBackgroundTaskInvalid;          }];  
  7. 7. ¡  Can  register  app  for  ‘significant  changes  in  distance’.  ¡  In  practice  updates  usually  come  every  5  minutes  ¡  App  will  be  notified  when  location  changes  by  significant  amount  ¡  App  will  also  be  started  if  it  has  been  killed    self.locationManager  =  [[CLLocationManager  alloc]  init];  [self.locationManager  startMonitoringSignificantLocationChanges];    
  8. 8. ¡  Apps  registered  as  providing  VOIP  services  have  the  following  abilities  §  Get  automatically  restarted  if  killed  §  Get  woken  up  if  data  arrives  on  VOIP  control  socket  §  Can  register  for  ‘keep  alive’  updates  ▪  Intended  to  refresh  socket  connections  if  needed  ▪  Minimum  10  minutes  between  updates  
  9. 9. [application  setKeepAliveTimeout:600  handler:^(void)  {                  NSLog(@"Keep  alive  timeout  triggered");    }];        CFReadStreamRef  readStream;    CFWriteStreamRef  writeStream;            CFStreamCreatePairWithSocketToHost(NULL,  (CFStringRef)@"",1343,  &readStream,  &writeStream);                  CFReadStreamSetProperty(readStream,kCFStreamNetworkServiceType,kCFStreamNetworkServiceTypeVoIP);          CFWriteStreamSetProperty(writeStream,  kCFStreamNetworkServiceType,  kCFStreamNetworkServiceTypeVoIP);    
  10. 10. ¡  All  animations  defined  in  Edge  Animate  as  CSS3  property  animations  ¡  Timeline  with  each  property  having  start  /  end  values  on  timeline  §  Position  §  Scale  §  Opacity  §  Shadow  ¡  Different  easing  functions  available    
  11. 11. ¡  CABasicAnimation  for  animating  layer  properties  ¡  CAAnimationGroup  for  animating  properties  at  the  same  time  ¡  CAKeyframeAnimation  for  custom  easing  functions  
  12. 12. ¡  Tools  to  take  the  CSS3  animations  and  convert  them  into  Core  Animation  keyframe  animations  ¡  Currently  a  manual  operation,  but  could  be  automated  considerably  
  13. 13. ¡  Simple  app  but  quite  a  lot  of  engineering  required  to  get  the  required  result  ¡  App  delivered  within  3  weeks  ¡  Working  with  client  on  v2.0  which  will  get  a  public  release