Skip to main content

Posts

Showing posts with the label Ionic

Ionic 4 - There is always a way back

I’m currently working on a PWA using Ionic 4 and I really like the experience so far. After all the struggles with Xamarin and Phonegap this is really a relieve. However every technology has it’s tradeoffs and one of the problems we encountered when using Ionic was the following: We were using the ion-back-button control for our navigation inside the app. From the documentation : The back button navigates back in the app's history upon click. It is smart enough to know what to render based on the mode and when to show based on the navigation This control worked perfectly until the user decides to do a full page refresh(don’t ask why he/she should do that). After a full page refresh the navigation stack is lost and the user is stuck on the current page without any navigation option to go back. Luckily a colleague found a solution and it was all there in the documentation: The ion-back-button has a defaultHref property that can be set to a url. This url is used to...

Ionic Menu control won’t refresh

Last week we lost a lot of time investigating an issue with ‘ion-menu’ , one of the built-in controls of Ionic. The problem was that once the menu was opened it would no longer refresh it’s data. What we do is showing some user data on the top of the menu, this data is returned with an http call from the server and updated through an observable subscription. However pushing a new value on the observable had no effect on the view although the component data was in fact updated. As a workaround we used the built-in event bus to publish an event once the user was loaded. We handle this event on the viewcomponent and use it to explictly trigger a change detection: More information about the ChangeDetectorRef can be found here: https://alligator.io/angular/change-detection-strategy/

Ionic Build – Gradle throws “Could not reserve enough space for object heap” error

Compiling and running an Ionic application on your Android device is a whole lot of fun, requiring a big list of tools and a little bit of good luck. It seems that I was out of luck as I got the following error message during the startup of Gradle: Could not reserve enough space for object heap To solve it, I specifically downloaded and installed the 64bit version of Java: After the installation completed, I updated my JAVA_HOME environment variable to point to the 64bit version: