Skip to Content

Setup

Cloud Connector

If you are using Gateway (rather than OData Provisioning) you may need to set the trust flag for the SAP Cloud Platform (SAP CP) dispatcher (in the Principle Propagation section).  The Fiori Mobile project might be the first time you have used app-to-app SSO. We had a 401 error when our offline app began to sync and it was resolved by checking this one checkbox.

 

Develop

Managing multiple environments

You’re going to need to build three variants of your app (assuming that you have dev/test/prod environments).  Each version will reference a different environment.  So, from the start, make it easy to distinguish between them.  You may be running dev, test and prod versions of your app simultaneously on your phone.  You might want to call the 3 versions D_MyApp, T_MyApp and MyApp, so you know which one is which.

To move our app changes through the environments (dev to prod), taking account of the small differences in project setup (e.g. different sub-account guids), we used GIT branches.  We had one branch for each environment.

When our latest build in dev was ready we would open the Web IDE in the test sub-account and switch to the test branch. We would then merge-in the development branch.  Next we would build the app and then testing could commence.

When testing was complete we would open the Web IDE in production, merge in from the test branch and do a build.  The master branch can be used for prod.

Feature branches can be created from the development branch.

I must say that prior to this I had never opened the Web IDE in any environment other than dev!  I don’t really like doing so but this was the best approach we could come up with.  Note that because of the way GIT works, we don’t have to repeat the entry of the sub-account GUIDs in the project settings, for example.  Once we have done this once, we can apply the new features from dev without overwriting those settings.  For this you must become proficient at conflict resolution.

You might like to choose a different Web IDE theme in each environment.  That way you will never make a change to the code in prod mistakenly thinking you are in dev, because the colours are clearly distinguishable.

Mobile Secure

Most of your app setup can be done in Mobile Secure.  You can launch this via the Fiori Mobile service in the Cloud Platform cockpit.

Mobile Secure betrays it’s heritage as a separate product (I assume) and doesn’t work quite the same as other SCP screens.  I haven’t found a way to log on to multiple sub-accounts simultaneously (e.g. to compare dev to test) as I do all the time with the Web IDE or the Mobile Service for Development and Operations for example.  If you save the URL as a bookmark always check the sub-account GUID in the account name before you log in, otherwise you might end up going back to the last environment you logged into.  Indeed it’s best to log out before trying to access a different environment.

Sometimes Mobile Secure seems to load with a blank grey screen, but an F5 refresh soon fixes it.  This happens with the Mobile Service for Development and Operations UI too.

Gateway Services for Offline

I’ll mention a couple of things that we discovered, without trying to write a comprehensive guide to offline.

Delta tokens (using a change log, similar to the agentry approach) only seem to work if the tokens are in ‘GUID_Timestamp‘ format.  We tried just using a timestamp but we got some errors.

Key fields (OData properties) must have a max. length defined in the metadata (i.e. in Gateway Builder, SEGW).

Blank screen issue

If you get a blank screen when you run your app try setting a different UI5 version on the portal site.  We currently have ours on UI5 1.46.11.

Offline

If you upload an application configuration file in Mobile Secure (to optimise the offline settings for your app) you must use the connection name not the ID.  This is covered by KB article 2525195.  The beginning of your file will look like this:

If you upload an application configuration file in Mobile Secure (to optimise the offline settings for your app) you must use the destination ID as the endpoint name.  You can get this by accessing the offline settings for your app in Development & Operations. The beginning of your file will look like this:

[endpoint]
name=com.sap.fiorimobile.con.Fiori_Cloud_Edition

You can also check and download the settings from Development & Operations.  At the time of writing the settings you upload still aren’t displayed in Mobile Secure.  I see ‘No external offline settings imported’.  However when I check in Development & Operations all my settings are there.

You may find that if your file includes multiple defining requests only the very last defining request is uploaded successfully.  There is currently a work-around in place to use postman to upload the configuration file and this ensures that everything is uploaded correctly.

If you are using delta queries for your offline app you must use XML format for your OData responses rather than JSON.  This caused us some issues in the UI5.  For example dates and booleans were showing as strings in the JavaScript.  I’m not sure if this is a known binding issue or something specific to UI5 version 1.46.  To handle all scenarios you can write you statements like this:

if (myProp && myProp !== "false") {

}

Online/offline mix

In our app we wanted to use some OData services in an offline mode and some (pre-existing services) in an online mode.  This proved to be a little tricky and I would avoid doing a mix if you can.  You can’t declare the online services in the manifest and when you do declare them you have to read the absolute path from one of the offline stores.  A mix also makes the authentication trickier because back-end calls are required more frequently.

Cloud Build

Debug-enabling

Be aware that selecting Build debug-enabled binaries can have unexpected consequences.  We had an issue with file upload (when running the app) that only occurred if the debug option was selected.  In addition, at the time of writing, iOS apps aren’t 64 bit (and therefore iOS11 compatible) if the debug option is selected.

 

App Download

CDN for faster downloads

Make sure you have the Content Delivery Network (CDN) option enabled.  This won’t speed up the very first download (from Mobile Place) but it should speed up subsequent downloads.  In our experience however it still seems quite slow.

Global

Account->Settings->Mobile Place

No need to authenticate

To allow users to download the app from Mobile Place without needing to authenticate you need to change settings both at the global and the app level.

Global

Account->Settings->Mobile Place

App

Applications->Manage Apps

Detail tab

Download on PC or mac

If you open Mobile Place on your PC or mac it won’t give you a download option because you aren’t on a mobile device.  You can fool it though by turning on device mode in the Chrome debugger.  This means you can download the file to your PC before attaching your mobile device to install it.  Even better, you can download the file from the build-complete dialog in Web IDE.

Debugging

It’s surprisingly easy to debug your app, if you did select Build debug-enabled binaries when you built it.  To debug an Android device connect it to a PC and enter the following URL into Chrome:

chrome://inspect/#devices

To debug an iOS device connect it to a mac and find the device via the developer menu in Safari.

With Fiori web apps I frequently turn debugging on so that I can debug the SAP-standard UI5 libraries.  I don’t believe there is a way to do this with Fiori Mobile.

Logs and Traces

For logs and traces you need to log on to the Mobile Service for Development and Operations.  A network trace captures all of the requests that go through mobile services (a.k.a. CPms).  There are often 2 matching requests, because there is a proxy component which makes the ultimate call to the OData backend.

You can download the trace as an HTTP archive (.har) file.  There are online viewers, but I found a Chrome extension viewer easier to use, especially with larger files.

To trace requests between the mobile client and SAP Cloud Platform mobile services (CPms) you can use Fiddler.  You install fiddler on your PC then configure the wi-fi settings on your phone so that your PC is used as a proxy.  Fiddler logs all of the network requests from your phone. I found this worked best when I did it at home, where there are only a handful of devices on the wi-fi network.

 

Support

You can raise incidents under MOB-FM (general Fiori Mobile) or MOB-FM-SEC (Mobile Secure, Mobile Place).

 

Back to Fiori Mobile Overview

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply