Ionic livereload device11/19/2023 I opened an ER for the Ionic CLI to warn users about this and I'd appreciate folks input (either for or against) if you are an Ionic user. Ionic's Live Reload is freaking helpful as hell, and the PhoneGap Developer App is the number one way to test PhoneGap/Cordova quickly (and will be what I use in presentations in the future), but you want to remember these issues when testing. To be clear, I'm not suggesting to avoid these features. In my particular use case, I could switch to using base64 images, but I'm going to avoid that as it isn't typically recommended. This makes sense, but is definitely a bit of a bummer if you need to test anything involving the file system. To confirm this was an issue, I also tested with the PhoneGap Developer App and I had the exact same problem. With ionic serve, Live Reload just refers to reloading the browser when changes are made. That means the URIs returned by the camera plugin were referencing URIs on the computer that did not exist. When using live reload, you're actually running the assets off the computer and not the device. I then realized what the culprit was - live reload. On a whim, I stopped, and switched to just doing cordova emulate ios. I had been using Ionic's kick ass live reload feature while testing. This is what had originally reminded me to use the sanitization setting in Angular, but I was seeing it in my non-Angular example as well. While testing, I was debugging of course, and I noticed this error in the console: Not allowed to load local resource. I then tried my basic camera demo from my Cordova examples repository - an app I had built a while ago and was as simple as possible - and that failed too! I've used the Camera numerous times before with Cordova so I assumed it must have been an Angular issue. I noticed I had the same issue.Īt this point I hit a brick wall. I had been testing with iOS so I quickly switched to Android and tested there. The fix for that is rather simple - just add a regex to imgSrcSanitizationWhitelist: $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|content|file|assets-library):/) While testing, I noticed that I couldn't see an image I had selected from the gallery.Īt first, I thought it was the Angular issue (ok, they call it a feature, and I get the reasoning, but I call it a bug and I'm happy to be wrong) where the library will block you from injecting potentially dangerous stuff into the DOM. I'm working on a set of demos using Ionic and Cordova that demonstrate a particular use case of the camera. Make sure that you are connected to the same WiFi on your device and computer. Run your project and livereload should work. My Ionic Info is as follows:Ĭordova Plugins : cordova-plugin-ionic-keyboard 2.1.3,Ĭordova- plugin-ionic-webview 3.1.This morning I ran into an odd issue with what should have been relatively simple code. For those still struggling with his try: ionic capacitor run ios -livereload -external. The app tries to call the web api, but this is prohibited by the Same Origin Policy.To overcome this issue you need to enable CORS on your web api. I am stuck with the above problem - I will highly appreciate if any fellow devs could get me out of this soup!! Since the cordova app is loaded from the device file system, it has a different origin than the web api. watch ready in 9.98 sįinally I added the following permissions to AndroidManifest.xml. Both above automatically assign host/IP with port number. and ionic run android -l -c opens it on your device which is connected your pc and port forwarded using chrome inspect. dev-logger-port 53703 -consolelogs -nobrowser -iscordovaserve ionic serve is used for web based app which opens in the default browser. > ionic-app-scripts serve -address 0.0.0.0 -port 8100 -livereload-port 35729 Then I added an Inbound Rule to my Windows Firewall to allow specifically the following ports : 8100, 35729, 53703 as these appeared on the console with the following command: ionic cordova run android -livereload -consolelogs So it specifically mentions loadUrlTimeoutValue as 700000 - but that did not have a positive effect ! In one of my projects where the -livereload flag was working, suddenly the feature is not working but I see Launch Success message on my console.Īfter launching the app on my android device the Splash screen stays on infinitely and then a message appears as Application Error
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |