SlideShare a Scribd company logo
1 of 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

More Related Content

Similar to 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
 

Similar to 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.
 

Recently uploaded

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Recently uploaded (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

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

Editor's Notes

  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