SlideShare uma empresa Scribd logo
1 de 19
Don’t Gap The Bridge




Bridge The Gap
Piotr Steininger

• Software enthusiast and architect
• Background: PHP, JEE, ExtJS, SproutCore
• Worked with: GEICO, FINRA, Time
• SproutCore: SI for Android, Fortune500+
JS-to-Native-to-JS

• Challenge: access to Mobile phone features
 • accelerometer
 • local storage
 • CAMERA, Microphone, etc
• Solutions: PhoneGap, Titanium ?
PhoneGap - Features
• Supports 6 platforms
• Features
 • Accelerometer, Compass, GPS
 • Camera, Audio
 • Storage/File System
 • Notifications (sound, vibration)
PhoneGap - Issues
• Tries to cover too much ground
• Overly complex
• Excessive amount of code
• Slow (due to the above)
• Many features already in WebKit
• Breaks SproutCore !
The Project
•   SI Magazine

•   Reader app, rich UI

•   Support various content
    types

•   Run on iPhone and
    Android

•   Limited JS-native needs
Project Needs
• Access to Native Debug console
• Secure off-line storage and caching of data
• 2-way JS-native Bridge with callbacks
• Change native controls based on JS UI
  changes
• Ability to execute select native commands
Problems
• PhoneGap does not work (well) with
  Sproutcore
 • Uses custom URL schemes on iOS to
    send commands to native
 • Causes split second loss of access to
    DOM
 • Sproutcore blows up silently during
    rendering and stops the app
More Problems

• Works differently on Android
 • Uses a long-polling AJaX server (?!?!)
• Bloat (!) - too many features
• Slowdowns
• Too much complexity
Solutions

• Step 1: on iOS change transport layer
• Step 2: remove 99% of PhoneGap
• Step 3: Keep it simple
iOS

• Used SC.Request instead of
  window.location.url
• Intercepted psuedo-XHR requests in iOS
  default cache
• Rewrote requests and redirected to PG
  command infrastructure
iOS Details

• Extend NSURLCache
• Override cachedResponse method to
  intercept URLs
• Used http://gap/... instead of gap://....
• New JS-to-Native API + callback support
iOS Details
@interface MyURLCache : NSURLCache {
}

@implementation MyURLCache
- (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request {

 NSString *pathString = [[request URL] absoluteString];


 if ([pathString rangeOfString:@"http://gap/"].location != NSNotFound) {

     pathString =
    [pathString stringByReplacingOccurrencesOfString:@"http://gap/" withString:@"gap://"];

 
    NSNotification *n =
   [NSNotification notificationWithName:DidReceiveJSNotification object:pathString];

  [[NSNotificationCenter defaultCenter]
    performSelectorOnMainThread:@selector(postNotification:)

 
      withObject:n waitUntilDone:NO];

 }


 return nil;
}
iOS Details
//in app delegate didFinishLaunchingWithOptions:

MyURLCache *cache = [[MyURLCache alloc] init];

NSURLCache setSharedURLCache:cache];

[cache release];
Android

• No part of PhoneGap used
• Java Class and exposed to WebView
• Separate and simpler JS API to match iOS
  (same API different guts)
Android Details
public class NativeInterface {
   private static final String TAG = "NativeInterface";
   private WebView appView;
   private App activity;
   public NativeSupport(WebView v, App activity) {
       appView = v;
       activity = activity;
   }
   ...
}
Android Details
public class App extends Activity {
private WebView webView;
private NativeInterface nativeInterface;
...
public void onCreate(Bundle savedInstanceState) {
  nativeInterface = new NativeInterface(webView, this);
  webView.addJavascriptInterface(nativeInterface,"NativeInterface");
}

...
webView.loadUrl("javascript: SCApp.function(...);”);
Conclusion

• There IS a NoGap way
• Pick your battles wisely!
• Evaluate your needs and decide
• iOS and Android expert on your team
Q&A

• Piotr (Peter) Steininger
• Contact Info:
 • http://about.me/piotr.steininger
 • piotr@tapangi.com

Mais conteúdo relacionado

Semelhante a Bridge the gap

ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better NetworkingITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better NetworkingIstanbul Tech Talks
 
e10sとアプリ間通信
e10sとアプリ間通信e10sとアプリ間通信
e10sとアプリ間通信Makoto Kato
 
An overview of mobile html + java script frameworks
An overview of mobile html + java script frameworksAn overview of mobile html + java script frameworks
An overview of mobile html + java script frameworksSasha dos Santos
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for EngineersBrian LeRoux
 
Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...
Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...
Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...Yandex
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeJesse Gallagher
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical StuffPetr Dvorak
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.WO Community
 
Architecture app
Architecture appArchitecture app
Architecture appYnon Perek
 
PhoneGap - Now and the Future
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the FutureTim Kim
 
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]Sittiphol Phanvilai
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGuillaume Laforge
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersBrian Huff
 
Drupal and mobile devices komelin konstanin (eng)
Drupal and mobile devices komelin konstanin (eng)Drupal and mobile devices komelin konstanin (eng)
Drupal and mobile devices komelin konstanin (eng)drupalconf
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Ryan Cuprak
 
移动端Web app开发
移动端Web app开发移动端Web app开发
移动端Web app开发Zhang Xiaoxue
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App DevelopmentChris Morrell
 
Никита Корчагин - Introduction to Apple iOS Development.
Никита Корчагин - Introduction to Apple iOS Development.Никита Корчагин - Introduction to Apple iOS Development.
Никита Корчагин - Introduction to Apple iOS Development.DataArt
 

Semelhante a Bridge the gap (20)

ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better NetworkingITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
 
e10sとアプリ間通信
e10sとアプリ間通信e10sとアプリ間通信
e10sとアプリ間通信
 
An overview of mobile html + java script frameworks
An overview of mobile html + java script frameworksAn overview of mobile html + java script frameworks
An overview of mobile html + java script frameworks
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...
Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...
Обмен учетными данными между iOS 8 приложениями и вебом, Константин Чернухо, ...
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Architecture app
Architecture appArchitecture app
Architecture app
 
PhoneGap - Now and the Future
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the Future
 
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Txjs
TxjsTxjs
Txjs
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud Developers
 
Drupal and mobile devices komelin konstanin (eng)
Drupal and mobile devices komelin konstanin (eng)Drupal and mobile devices komelin konstanin (eng)
Drupal and mobile devices komelin konstanin (eng)
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
 
移动端Web app开发
移动端Web app开发移动端Web app开发
移动端Web app开发
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App Development
 
Никита Корчагин - Introduction to Apple iOS Development.
Никита Корчагин - Introduction to Apple iOS Development.Никита Корчагин - Introduction to Apple iOS Development.
Никита Корчагин - Introduction to Apple iOS Development.
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Bridge the gap

  • 1. Don’t Gap The Bridge Bridge The Gap
  • 2. Piotr Steininger • Software enthusiast and architect • Background: PHP, JEE, ExtJS, SproutCore • Worked with: GEICO, FINRA, Time • SproutCore: SI for Android, Fortune500+
  • 3. JS-to-Native-to-JS • Challenge: access to Mobile phone features • accelerometer • local storage • CAMERA, Microphone, etc • Solutions: PhoneGap, Titanium ?
  • 4. PhoneGap - Features • Supports 6 platforms • Features • Accelerometer, Compass, GPS • Camera, Audio • Storage/File System • Notifications (sound, vibration)
  • 5. PhoneGap - Issues • Tries to cover too much ground • Overly complex • Excessive amount of code • Slow (due to the above) • Many features already in WebKit • Breaks SproutCore !
  • 6. The Project • SI Magazine • Reader app, rich UI • Support various content types • Run on iPhone and Android • Limited JS-native needs
  • 7. Project Needs • Access to Native Debug console • Secure off-line storage and caching of data • 2-way JS-native Bridge with callbacks • Change native controls based on JS UI changes • Ability to execute select native commands
  • 8. Problems • PhoneGap does not work (well) with Sproutcore • Uses custom URL schemes on iOS to send commands to native • Causes split second loss of access to DOM • Sproutcore blows up silently during rendering and stops the app
  • 9. More Problems • Works differently on Android • Uses a long-polling AJaX server (?!?!) • Bloat (!) - too many features • Slowdowns • Too much complexity
  • 10. Solutions • Step 1: on iOS change transport layer • Step 2: remove 99% of PhoneGap • Step 3: Keep it simple
  • 11. iOS • Used SC.Request instead of window.location.url • Intercepted psuedo-XHR requests in iOS default cache • Rewrote requests and redirected to PG command infrastructure
  • 12. iOS Details • Extend NSURLCache • Override cachedResponse method to intercept URLs • Used http://gap/... instead of gap://.... • New JS-to-Native API + callback support
  • 13. iOS Details @interface MyURLCache : NSURLCache { } @implementation MyURLCache - (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request { NSString *pathString = [[request URL] absoluteString]; if ([pathString rangeOfString:@"http://gap/"].location != NSNotFound) { pathString = [pathString stringByReplacingOccurrencesOfString:@"http://gap/" withString:@"gap://"]; NSNotification *n = [NSNotification notificationWithName:DidReceiveJSNotification object:pathString]; [[NSNotificationCenter defaultCenter] performSelectorOnMainThread:@selector(postNotification:) withObject:n waitUntilDone:NO]; } return nil; }
  • 14. iOS Details //in app delegate didFinishLaunchingWithOptions: MyURLCache *cache = [[MyURLCache alloc] init]; NSURLCache setSharedURLCache:cache]; [cache release];
  • 15. Android • No part of PhoneGap used • Java Class and exposed to WebView • Separate and simpler JS API to match iOS (same API different guts)
  • 16. Android Details public class NativeInterface { private static final String TAG = "NativeInterface"; private WebView appView; private App activity; public NativeSupport(WebView v, App activity) { appView = v; activity = activity; } ... }
  • 17. Android Details public class App extends Activity { private WebView webView; private NativeInterface nativeInterface; ... public void onCreate(Bundle savedInstanceState) { nativeInterface = new NativeInterface(webView, this); webView.addJavascriptInterface(nativeInterface,"NativeInterface"); } ... webView.loadUrl("javascript: SCApp.function(...);”);
  • 18. Conclusion • There IS a NoGap way • Pick your battles wisely! • Evaluate your needs and decide • iOS and Android expert on your team
  • 19. Q&A • Piotr (Peter) Steininger • Contact Info: • http://about.me/piotr.steininger • piotr@tapangi.com

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n