Professional Documents
Culture Documents
Public
Speakers
The information in this presentation is confidential and proprietary to SAP and may not be disclosed without the permission of
SAP. Except for your obligation to protect confidential information, this presentation is not subject to your license agreement or
any other service or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this
presentation or any related document, or to develop or release any functionality mentioned therein.
This presentation, or any related document and SAP's strategy and possible future developments, products and or platforms
directions and functionality are all subject to change and may be changed by SAP at any time for any reason without notice.
The information in this presentation is not a commitment, promise or legal obligation to deliver any material, code or functionality.
This presentation is provided without a warranty of any kind, either express or implied, including but not limited to, the implied
warranties of merchantability, fitness for a particular purpose, or non-infringement. This presentation is for informational
purposes and may not be incorporated into a contract. SAP assumes no responsibility for errors or omissions in this
presentation, except if such damages were caused by SAPs intentional or gross negligence.
All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially
from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only
as of their dates, and they should not be relied upon in making purchasing decisions.
Setup
A quick look at the software used for this session
OData
Accessing data
HTML5 based app
Basic HTML5 app that accesses an OData backend
Debugging using Web Inspector
Examine logged messages, HTTP requests, variables, and set breakpoints
SAP Fiori
Learn about SAPUI5, Fiori UX, and the SAP Web IDE
Hybrid/Cordova/Kapsel
Create a HTML based UI wrapped in a native app that can access native features
Barcode scanner
Enhance the app with the ability to show details of a scanned barcode
Registering with HANA Cloud Platform mobile services
Logon Plugin
Native Logging
Logger Plugin
Offline enablement
Provide a device database that can handle requests and modification while the device is disconnected
Offline Errors
Intro to Error Handling in Offline Apps
Document Service
Managing unstructured content
Push
Receiving notifications
AppUpdate
Make changes to the deployed app without using an app store
Public
OData
OData
Atom
Publishing
A method of accessing data that is self-described and is
Atom JSON
easily accessible using just a browser. Syndication
Public
HTML5 based app
Pros
Build the UI once and it runs on many platforms
Updates are easy, simply update the content on the web server
JavaScript/HTML is a very well known language
Cons
Native is faster and more functional
Limited access to native device features like contacts, barcode scanner etc.
Need to consider caching so content that is not updated frequently can be cached
Can be difficult to handle data requests and updates with no network
Public
Debugging using web inspector
Learn about SAPUI5, Fiori UX, and the SAP Web IDE
Public
SAP Fiori
What is SAPUI5?
A JavaScript UI library created by SAP and an open source version called OpenUI5
Create a HTML based UI wrapped in a native app that can access native features
Public
Hybrid/Cordova
Mobile Device
Mobile Device
Native Application
Native Application
Web View
WebView
JavaScript, CSS, HTML, etc.
JavaScript, CSS, HTML, etc.
Kapsel
3rd party plugin
Cordova Container
is shipped as a standard part of the 3rd party plugin
SAP Mobile SDK
AppUpdate
is the name of a set of SAP Hybrid Business AuthProxy
specific plugins for Apache Cordova Application EncryptedStorage
(SAPUI5) Logger
plugins behave exactly like any other
Logon
3rd party Cordova plugin
Push
JavaScript Interface
plugins give Cordova applications Settings
enterprise capabilities via the Cloud Platform Offline
(HCPms) or On-premise (SMP3) Libraries etc
solutions
Device APIs Kapsel
runs on Android, iOS and Windows
H/W Features of Mobile Device
Mobile Device
Enhance the app with the ability to show details of a scanned barcode
Public
Barcode scanner
function scan() {
cordova.plugins.barcodeScanner.scan(scanSuccessCallback, scanErrorCallback);
}
function scanSuccessCallback(result) {
log(JSON.stringify(result));
}
function scanErrorCallback(error) {
alert("Scanning failed: " + JSON.stringify(error));
}
Complete Exercises 1 7
Public
Registering with HANA Cloud
Platform mobile services
Logon Plugin
Public
Registering with HANA Cloud Platform Mobile Services (HCPms)
function register() {
var appId = "com.sapteched.mob161";
var context = {
"serverHost": "<HCPms Host>",
"https": "true",
"serverPort": "443"
};
function logonSuccessCallback(result) {
JavaScript
alert("Successfully Registered");
}
function logonErrorCallback(error) {
console.log("An error occurred: " + JSON.stringify(error));
}
Public
Logging
function setLogLevel(logLevel) {
sap.Logger.setLogLevel(logLevel);
}
function getLogLevel() {
sap.Logger.getLogLevel(getLogLevelSuccess, getLogLevelFailure);
}
function getLogLevelSuccess(level) {
console.log("MOB161 Log Level is " + level);
JavaScript
}
Provide a device database that can handle requests and modification while the device is disconnected
Public
Offline enablement
function openStore() {
var properties = {
"name": "gtmDemoOfflineStore",
"host": applicationContext.registrationContext.serverHost,
"port": applicationContext.registrationContext.serverPort,
"https": applicationContext.registrationContext.https,
"serviceRoot" : appId,
"definingRequests" : {
SalesOrders" : "/SalesOrderHeaders",
"SalesOrderItems" : "/SalesOrderItems"
}
};
store = sap.OData.createOfflineStore(properties);
store.open(openStoreSuccessCallback, errorCallback);
JavaScript
JavaScript
}
function openStoreSuccessCallback() {;
sap.OData.applyHttpClient(); //Offline OData calls can now be made against datajs.
}
function flushStore() {
store.flush(flushStoreSuccessCallback, errorCallback);
}
JavaScript
function refreshStore() {
store.refresh(refreshStoreCallback, errorCallback);
}
Public
Offline error handling
Annotations
Can be used identify which entities have been modified locally or which entities are in an error state
Entities in an error state can be updated and then flushed again
Error Archive
Provides details of failed flush and refresh operations
Deleting an entry from the error archive will revert the entities to the state they were in prior to the flush
or refresh operation
Public
Document Service Overview
SAP HANA Cloud Platform document service provides an enterprise cloud content repository for unstructured or semi-
structured content.
Key capabilities
Customer
Content repository for unstructured or semi-structured
content HTTPS Internet
Define hierarchies and metadata
Support for access controls, checkout and versioning Applications on
SAP HANA
Based on OASIS content management interoperability
Cloud Platform
Cloud Platform
services (CMIS)
SAP HANA
Benefits Document Service API
Multi-tenancy and fully managed
Files are always encrypted (AES) before storage
Document Service
Key capabilities
It is enabled by default. No need to configure anything in
the HCP mobile services cockpit to enable the document
service integration.
It automatically creates an application folder under a
common repository under the tenant for each application
Benefits
Allow mobile apps to upload, share, distribute and retrieve
static content from and towards your mobile users
function connectCMIS(fname) {
cmisURL = "https://"+ applicationContext.registrationContext.serverHost + "/mobileservices/persistence/v1/json/"+appId
session = cmis.createSession(cmisURL+"/$metadata");
session.setCredentials(applicationContext.user, applicationContext.password).loadRepositories({
request : {
success : function(data) {
updateStatus1("Connected to Document Store");
//once the connection has been established, it gets the root object
getRootObject(fname);
},
error : function(e) {
if (e.responseJSON)
console.log( "Error during the request: " + e.responseJSON.message);
JavaScript
JavaScript
else
console.log( "Error during the request: " + e.statusText);
}
}
});
}
Receiving notifications
Public
Push
Push to
Specific user Native
Specific device
Multiple devices Push
Users of an app Providers
APNS
Native Push Push via API
App
BPS
HCPms
Device GCM
WNS
function registerForPush() {
var nTypes = sap.Push.notificationType.SOUNDS | sap.Push.notificationType.ALERT;
sap.Push.registerForNotificationTypes(nTypes, regSuccess, regFailure,
processNotification, null /* optional GCM Sender ID */);
}
Push out new changes to the app without using an app store
Public
Updating deployed apps
sap.AppUpdate.addEventListener("checking", function(e) {
console.log("Checking for update");
});
sap.AppUpdate.addEventListener("downloading", function(e) {
JavaScript
console.log("Downloading update");
navigator.notification.activityStart("Application Update", "Downloading...")
appUpdateTimer = setInterval(function() {
console.log('Downloading... ' + progress.toFixed(2) + '%');
}, 1000);
JavaScript
});
sap.AppUpdate.addEventListener("progress", function(e) {
if (e && e.lengthComputable) progress = e.loaded / e.total * 100;
});
sap.AppUpdate.addEventListener("noupdate", function(e) {
alert("No Update.");
});
// continued
sap.AppUpdate.addEventListener("error", function(e) {
navigator.notification.activityStop();
clearTimeout(appUpdateTimer);
navigator.notification.confirm("Application update failed",
function(buttonIndex) {
if (buttonIndex === 2) location.reload();
},
"Update", ["Continue Anyway", "Relaunch App"]);
});
sap.AppUpdate.addEventListener("updateready", function(e) {
navigator.notification.activityStop();
JavaScript
clearTimeout(appUpdateTimer);
});
sap.AppUpdate.onupdateready = function() {
navigator.notification.confirm("New update available",
function(buttonIndex) {
if (buttonIndex === 2) sap.AppUpdate.reloadApp();
},
"Update", ["Later", "Relaunch Now"]);
};
}
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate
company) in Germany and other countries. Please see http://www.sap.com/corporate-en/about/legal/copyright/index.html for additional trademark information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its
affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and
services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as
constituting an additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop
or release any functionality mentioned therein. This document, or any related presentation, and SAP SEs or its affiliated companies strategy and possible future
developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time
for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-
looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place
undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.