2

I want to build 1 UI for several phones (windows phone, Android, IPhone, etc). My plan is to create an HTML5 UI, and use JS to invoke applications that are installed on the mobile device. For example, I create windows phone 7 application without UI, and invoke functions of this application from the JS in the HTML 5 UI. Same goes for android, IPhone, etc.

Is this plan feasible at all? - How can I call windows phone 7 silverlight app/Android from JS?

Derek Lakin
  • 15,493
  • 30
  • 45
Ido
  • 871
  • 1
  • 11
  • 24

3 Answers3

2

Calling a native app from the browser is

Community
  • 1
  • 1
Olivier Payen
  • 14,950
  • 7
  • 39
  • 69
1

On iOS, you can't create a web app that calls native code, period. You mention that you want the app to have no UI, so I'm assuming you want to have a web app that invokes native code which in turn causes something to happen in the web app, or even causes something to happen on the device. Won't happen. You can use the iPhone's Custom URL Scheme to LAUNCH an application with given parameters so that when it opens it immediately does something, but you will get kicked out of the browser and in to your app. And App Store Guidelines wouldn't let you make an app that has no UI. It also doesn't allow for the creation of apps that are just WebViews wrapped around HTML.

On Android, I would imagine that you could create an app that is nothing more than a WebView that loads your webapp, and in that way you would have access to the native code you wrote for the device, but I don't think that would meet up in the middle the way you want it to when it comes to having the native code manipulate your web app. Plus Android UI's are mostly XML with a little bit of backing code so at that point you may as well be making a native app.

Doug Stephen
  • 6,761
  • 1
  • 34
  • 45
0

The browser in Windows Phone 7 does not currently support HTML5, though it is expected to arrive later this year. That said, I would extremely surprised if there was ever a public API that enabled a web site to open an application on the host device and I'd be surprised if this was allowed on Android or iPhone, too.

The only application that I'm aware of that exhibits this behavior is the YouTube application. If you visit YouTube.com on the WP7 browser, then it either launches the YouTube app if you have it installed, or prompts yout to download and install it. So, the capability is there, but I doubt very strongly if Microsoft would ever open it up beyond a close partnership for specific applications.

In Windows Phone 7, you can use the WebBrowser control within an application to host/browse web content, and from the application you can call javascript methods exposed by that page as described by Shawn Wildermuth in his Navigating with the WebBrowser Control on WP7 post.

Derek Lakin
  • 15,493
  • 30
  • 45