Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:21:37+00:00 2026-06-04T02:21:37+00:00

This app already exists in the Apple App store and Android markets. It is

  • 0

This app already exists in the Apple App store and Android markets. It is an app that uses a lot of native code and is not a candidate to be fully html5ed.

Longwinded Description

I want to have a Web-based series of settings pages. Some of these pages will live locally on the mobile device, and some will be hosted on a remote server. The native app will need to communicate with the local web pages to get and set information in the webpage using javascript.

For instance, the first page shown in the WebView/UIWebview will be a local index page. If the remote website is down, the links on the index page to the remote pages will be greyed out. On loading the WebView, the native app will need to detect the reachability of that page and send javascript to the page to grey out the buttons. Likewise, some settings changes made in the local web pages need to be sent back to the Native app for processing.

Short and Sweet Requirements Summary

  • Embed remote and local webpages in a webview
  • Theses webpages will be the same for both Android and iOS
  • Local pages use JavaScript to get data from and send data to the Native Mobile App

Potential Solution Pathways

A. PhoneGap

I realize that Phonegap would work well for this if my application was entirely a web app. From my reading it seems like Phonegap doesn’t really like to be embedded in a native app for part time work.

What? You say it’s really easy and I’ve been grossly misinformed? Enlighten me oh wise one.

B. Roll My Own

I’m open to rolling my own solution, however the methods for getting and setting information via Javascript from the Webviews to the Native Apps seems quite disparate. More-so the getting than the setting (bogus URLs for iOS, very nice AddJavaScriptInterface for Android). Also, it seems like this path could lead to a severe maintenance headache in the future.

Say what? Your genius programmer friend has made a website describing this process in excruciating detail? Tell me more.

C. 3rd Party Library

The perfect 3rd party library that does everything I want (and more!) exists? Save me from my ignorance.


Decision

In the future, it seems like PhoneGap’s ‘Cleaver’ project will be the best way to do this.

Since it’s not ready for Android yet, it seems that the current (Early June ’12) best solution for write-once-embedded-HTML is to use a fake URL scheme to communicate from the web page to the native app (both platforms can execute JS on the page directly when going from native app to web page).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:21:38+00:00Added an answer on June 4, 2026 at 2:21 am

    For Android this is simpler to do. Take a look at WebView‘s addJavascriptInterface method. You can create your own object with methods that can be called directly in the HTML javascript.

    iOS requires a bit of trickyness. Best solution for these types of problems is a couple things:

    • For callbacks to iOS you will need to basically make up your own URL scheme like native://somehost.com/somepath When your javascript wants to inform the iOS code use window.location = 'native://somehost.com/somepath';
    • Set the UIWebView delegate to an object that defines webView:shouldStartLoadWithRequest:navigationType: it will look something like this

      if ([request.URL.scheme isEqualToString:@"native"]){
          if([request.URL.host isEqualToString:@"somehost.com"]) {
              //Do the code you need to do here, branch off depending
              //on the path and/or host, you can parse parameters here too
              return NO; //This will keep UIWebView from trying to actually load 
                         //your made up scheme
          }
      }
      return YES; //If the request isn't one you want to intercept return YES/true
                  //so UIWebView will load the page
      
    • To have your iOS code send information or call functions in your javascript you can use WebView’s stringByEvaluatingJavaScriptFromString:. This will return the result of a javascript expression so you can also use it to get some information from the page itself. To call a function use something like this

      [webview stringByEvaluationgJavaScriptFromString:@"myJavaScriptFunction();"]
      

    You can also handle the made up scheme in Android by creating a custom WebViewClient and overriding the shouldOverrideUrlLoading method similarly to the iOS code above except the return calls are backwards, you return true if you handled the URL and the WebView should do nothing more, and false if you want the WebView to handle loading. Be sure to create and assign the custom WebViewClient to the WebView using setWebViewClient. To call javascript functions on the actual WebView do something like webview.loadUrl("javascript:myJavaScriptFunction();");

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify
So I have this App in the store, and I would like to release
[edit] I am NOT using jquery in this app. Looking for a way to
With a DataContext and a blank file-based database that already exists , is it
currently I have this client code in my PHP MVC web app: try {
I've seen a question exactly like this already exists: Redirect stdout to an edit
When the users of this app make changes to the fields a large amount
So I have this app which needs to query entities from the Azure Tables
So im making this app where user could add UP to 3 images to
I had this app using 1.9.2 and rails 3.2 and today I changed the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.