According to the documentation "Hybrid apps are built in either connected or offline mode. This allows you to maintain two mobile device profiles; one for users that are always online and one for users with intermittent connectivity".
As far as I know it is not possible to automatically switch between profiles depending on the availability of an internet connection. Using both profiles will result in two independent apps. One which will require the user to be always online, and one for users with intermittent connectivity.
What Allard says is correct. You either choose the online profile, or the offline profile, so this is not possible out of the box. The issue here is also, when do you sync data? Before you "switch" to offline, you need to sync your data else you have outdated data. However, in many cases you do not know when you are going to lose connection.
Let us know if you need help with building an offline capable app. Note that the upcoming release (7.4.0, June 30) makes it possible to directly edit objects.
Thank you all for your answers. it gave me the direction to follow
Set enableOffline true. See: https://docs.mendix.com/refguide/configuring-hybrid-mobile-apps-to-run-offline
Try Sync-button. See: https://docs.mendix.com/refguide6/sync-button