4
votes

I'm working with a hybrid app that was built out in Ionic, and I'm wondering if it is possible to run this on iOS without using Cordova/PhoneGap. To make a long story short, I need it to run in webview on a hybrid platform that ISN'T Cordova or Phone Gap. Since ionic DOES work on desktop browsers, I'm assuming this is possible (Is this assumption wrong?)

Right now the app is getting hung up at the point where, in the ionic bundle's initialization, ionic.platform has it "ready" function fired with "this.isReady" getting set as true. As far as I can tell, during setup the app is listening for a "deviceready" event for webview, which isn't getting fired without the Cordova framework. I tried setting up a timed function like the following to simulate this:

window.setTimeout(function() {
        var e = document.createEvent('Events'); 
        e.initEvent("deviceready", true, false); 
        document.dispatchEvent(e);
    }, 5000);

Unfortunately, this also hasn't worked for me. I'm wondering if there might be some other method workaround? It may be better to edit the platform to "trick" ionic into thinking it is running on a desktop browser. I've tinkered with this, but it hasn't worked for me so far.

I've already posted this to the ionic forum, but perhaps someone on stack overflow might have some ideas.

1
If you are trying to test an app without cordova and require the device features then it is impossible to cut story short. However if you just want to test the web app itself, then sure you can with ionic serve commandSani Yusuf
Wrong... It's possible, but you have to use your own homebrew solution to make native calls.Trevor Record

1 Answers

2
votes

I've got an app in production which is built in Ionic. You can just use the www/ directory and everything will work as you expect.

I think you have a different problem than you think you have, because it should work. I think the deviceready event is only used by cordova and not by Ionic per se.