cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Demo Mode to an MBO-based App?

SergioFerrari
Active Contributor
0 Kudos

Dear community members,

  once you get your App running with a back-end system, it would be very useful to any clue to add the possibility save the last state of the local database in order to use it for Demos.

  Most of SAP packaged Apps provides a Try Sample Data / View Sample Data mode and I'm wondering if there is a smart way to integrate it into a developed App without going manually creating an xml file to populate the local database in a programmatic way.

  thank you,

Sergio

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sergio,

      You can try following : (This should work as i have used this before)

Step 1: Setup a demo user in your backend system.

Step 2: Synchronize a device with backend system using this user. (You may want to turn off device's database encryption , Or else you would need to hardcode encryption key of your demo database in your application source code)

Step 3: Copy database file from device's documents folder and include this database file as a resource in your application project and rebuild the project.

Step 4: When app launches you can check if database exists already in documents folder (SUP database class provides a method called "databaseExists" to check this) . Now if database does not exists , show two buttons :  "Setup Application" , "Try with Sample data" .

If database exists , check if it is demo database , (You should save some flag somewhere to know whether app was used in real mode already)  , if app is not yet used in real mode , show two buttons s mentioned above , or else show login screen ...

Step 5: User click on "Try with sample data" button : Copy the demo database from resources folder to documents folder and display the first screen of app (say list of orders etc)

Step 6 : User clicks on "Setup application : Show the setup screen to allow user to enter connection details etc,Once setup is completed, you may want to store a flag somewhere indicating that app is in "real mode" and so next time onwards "Try with Sample data" button would no longer be there , instead users would see some login screen to enter some password.

Step 7: If users resets app , or unsubscribes the app, reset/delete your flag , and so user would again see two buttons on next launch.

Hope this helps,

Regards,

-Shiv

Former Member
0 Kudos

Please note : if you change your MBO model (Say in next version ) then you would need to download your demo database again...

_IvanFemia_
Active Contributor
0 Kudos

Kumar,

it seems interesting your approach... This allows you to see data and navigate into the app, but what about if user perform operations or sync, APIs try to connect to somewhere SUP that is not available/configured?

Thanks

Ivan

Former Member
0 Kudos

Sync in demo mode is not possible - demo is offline and is designed to be that.

All operations like create, edit are supported in this mode.

Please check our app Retail Execution in app store and that has demo deb. Your company as Techedge has used this app

_IvanFemia_
Active Contributor
0 Kudos

Thanks,

Finally I had a clear understanding of how SAP manage demo mode in his own MBO based app.

Ivan

SergioFerrari
Active Contributor
0 Kudos

Thanks Amit,

  help from your team is very important

Sergio

Answers (2)

Answers (2)

Former Member
0 Kudos

Sergio

I guess what you asked is the answer itself. If i understand correctly; your question is how to save the last state of an MBO based app that connects to SAP backend system? That is exactly what SUP does.

When you connect to SAP via SUP using MBOs, the app gets the downloaded data from the MBO (on server) onto the device local database. What you need to do next to stop the app from accessing SAP or SUP everytime is to ensure that you have a flag in the settings page of you app to ask the app to fetch data in "offline mode".

Or you develop the app in such a way that when there is no network connectivity then the app works in offline mode with the local DB. Remember you can login to the device database in offline mode with Native Object API apps in SUP parlance. Then you can demo the app in "airplane mode" 🙂

I dont know if you use Workflow based apps (??) but even there you can try if an MBO is used. The local DB will get created somewhere

PS: I do this with Native Object APIs to enable the demo mode or "offline mode".

Regards

LNV

joao_sousa2
Active Contributor
0 Kudos

The problem is when you want to distribute these demo apps without actually ever connecting to a backend server (SUP or otherwise). That was my problem at least.

Former Member
0 Kudos

Oh yeah Joao, trouble starts when you want to distribute. I would not distribute SUP based local DB apps to avoid license issues. Within an SAP store am not sure how it works though!

But if you wish to distribute to public markets, then you could always include a temp local DB to manage this.

Regards

LNV

joao_sousa2
Active Contributor
0 Kudos

I've only used this method with my own custom developments, not SUP based apps .

I agree it probably has licencing implications.

_IvanFemia_
Active Contributor
0 Kudos

Hi LNV,

I'm agree with you this will decrease developer overhead, but I was wondering how SAP distribute it own apps with demo mode support.

Are these apps some kind of offline app including first sync in the ipa/jar/apk? Or are they including a local data source (e.g. XML) and uses it as data source for first "dummy" sync with SUP local DB on the first run?

Thanks and Regards,

Ivan

SergioFerrari
Active Contributor
0 Kudos

Thank you to all of you, as Ivan is explaining here the point is how to include the last Sync status into the .ipa file to be then distributed.

Any more clue?

sergio

joao_sousa2
Active Contributor
0 Kudos

I've never actually done it with MBO, so take what I'm going to say with a grain of salt, as it may not work. I do it for non-SUP related demos:

For iOS:

- Connect the device to the Xcode;

- Go to Organizer -> Applications;

- Download the package for the application.

- You can then use this file to preload an newly installed application (yes, it's a bit annoying that you can't include it in the IPA).

For Android:

- Connect device to Eclipse;

- Go to debugger;

- Check the filesystem for your DB;

- Download to PC;

- Add the DB to the assets folder of the project;

- Include a class in your program that check if it is the first run, and if it is, creates new files and copies the assets you included over those new files (you can try to do this in iOS, I never had to).

- This is included in the APK, so even files from Google Play are correctly initialized.

I have no experience with Blackberry, but it's Java based so it should be the same as Android.

It's not exactly what you wanted, and I'm not sure it works with MBO, but it's better then nothing (and it does work with my other mobile projects).

PS: For Android you need a rooted phone or the emulator since you can't access /data in locked devices.