4D for Mobile : Get Mobile Users’ Cookies

As you probably know, scalable sessions have been available since 4D v18 R6. They’re a web session type that is able to handle several processes in preemptive mode. This means they can handle several user-agent requests simultaneously and share data between these processes.

Well, 4D v19 R7 greatly enhances this feature and makes it available to 4D for Mobile.

What does it mean for your mobile app?

From now on, your app users can be identified using the same session for web or mobile, a very convenient way to keep users’ data and offer an optimized user experience. This feature is promising as it’s the first step toward bridging the gap between (mobile) web and native apps and getting the best of both worlds in a single 4D for Mobile application.

How does it work

Technically speaking, when user sessions are enabled, web clients can reuse the same server context from one request to another. You can now get a user session for a user that uses a mobile app from their mobile device.

You can get the Session object from :

 

For example, here is session data that you can get from the On Mobile App Authentication database method :

And here is what you can get from a web area using 4D tags and the Session object in a mobile app :

blank

 

Where To Go From Here?

You can already use more web areas in your applications, which gives you more freedom in creating your application. For instance, with our last preset open URL action, you have the convenience of using the powerful 4D backend with native mobile abilities and the advantage of leveraging the fast and consistent UI development offered by 4D tags or whichever framework you choose.

Combining this session management feature with open URL action gives you more than front-end flexibility; this feature opens the doors to real-time data updates on your mobile; think about stock symbols and their values, temperature changes, employees and their geolocation, or even their online/offline status — just to name a few scenarios when data that arrives is updated frequently.

Let us know your thoughts on the 4D forum, and check out the documentation for more details!

David Azancot
• 4D for iOS Product Owner •David Azancot joined the 4D Product team as a Product Owner in 2017. He's in charge of writing the user stories and translating them into functional specifications. His role also includes making sure that feature implementations meet customers' needs.David graduated with an MBA in Marketing, Internet and Mobility from the Leonard De Vinci Institute and began his career in 2011 with a mobile start-up company, later acquired by Madvertise (a mobile marketing group). Passionate about mobile interfaces, he was the natural choice to develop interactive mobile ad formats for the group in 2015. In parallel, David has been developing his own iOS and Android applications since 2012.