SlideShare une entreprise Scribd logo
1  sur  49
Télécharger pour lire hors ligne
LR Mobile SDK &
LR Screens
Building an Android App with Liferay
Denis Signoretto,
Solution Architect and Project Manager at Intesys S.r.l.
@denissignoretto / #LRIS2015
Intro: Liferay & Mobile
Past, present & future
 Pre 2014 – Revamped remote services
(JSONWS)
 2014 – Liferay Mobile SDK API 1.0
 2015 – Liferay Screens ver. 1.0, 1.1, 1.2
 What’s next ?
 Just wait for Italy Symposium tomorrow 
@denissignoretto / #LRIS2015
App Story
We’ re going to show a sample Android Native
App build with Liferay Mobile Frameworks
The app allows a company store manager to
take under control the performance of his store
Dashboard Info:
 Sales Amount + % Variation from Last Year
 Profit Amount + % Variation from Last Year
 Hands On / In Order Inventory
 Days in Stock
 Incentive: Store Position
StoreDashboard
@denissignoretto / #LRIS2015
Building the App: 3 Steps
1 2 3
Data Access
Remote Services
Store Dashboard User/Pass
Authentication
StoreDashboard StoreDashboard
@denissignoretto / #LRIS2015
3 Main Liferay Ingredients
3
JSONWS API
Liferay Remote Services
Liferay Mobile SDK
Liferay Screens
@denissignoretto / #LRIS2015
Liferay as Mobile Backend
Liferay as a Mobile Backend
Liferay Portal
Finacial ERP/Stock
Inventrory
Incentive
JSONWS Remote Services
StoreDashboard
@denissignoretto / #LRIS2015
Let’s start !
@denissignoretto / #LRIS2015
JSONWS
Remote Services
1
1 2 3
@denissignoretto / #LRIS2015
JSONWS Remote Services
Liferay can expose via SOAP & JSON web services
SOAP (AXIS): http://localhost:8080/api/axis
JSON (JSONWS): http://localhost:8080/api/jsonws
JSONWS are JSON Restful Remote Services
 Liferay already expose all its services
 You can generate similar remote services for your custom entities as well (!)
1 2 3
@denissignoretto / #LRIS2015
 Liferay JSONWS stack:
 Authentication
 Security
 IP Layer, Auth/Verification Layer, Permission Layer
 Batch Calls
 Nested Calls
 JSON Serialization
JSONWS Remote Services
1 2 3
@denissignoretto / #LRIS2015
JSONWS are annotated service classes (LR 6.2)
 Do not rely on Service Builder but it does a lot of work for you !!!
 Service Builder is a two step code generator:
 From service.xml file → Interfaces API Generation + “Empty” Impl
 Modified Impl → updated API Interfaces
 Exposing remote services
 By Default plugin remote services are not exposed,
 Liferay expose remote services on WSDD generation
 when /WEB-INF/server-config.wsdd if found in your plugin
JSONWS Remote Services
1 2 3
@denissignoretto / #LRIS2015
JSONWebService Annotation
@JSONWebService public interface UserService { ... }
*ServiceImpl annotated methods can override interface annotated methods
Public Method
@AccessControlled(guestAccessEnabled = true)
Customize HTTP Method Name and URL
@JSONWebService (value = "add-board-wow", method = "PUT")
Ignoring a Method
@JSONWebService (mode = JSONWebServiceMode.IGNORE)
...
Your remote service methods should be implemented in *ServiceImpl classes
JSONWS Annotations
1 2 3
JSONWS Remote Services
@denissignoretto / #LRIS2015
Time for Coding
service.xml
http://localhost:8080/api/jsonws/remote-services-plugin-
portlet.<service>/...
From service.xml to remote services generation
1
1 2 3
@denissignoretto / #LRIS2015
Time for Coding
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN"
"http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.intesys.liferay.lris2015">
<author>Denis Signoretto</author>
<namespace>IT_INTESYS_LRIS_SAMPLE</namespace>
<entity name="finance" local-service="false" remote-service="true" uuid="false" />
<entity name="inventory" local-service="false" remote-service="true" uuid="false" />
<entity name="incentive" local-service="false" remote-service="true" uuid="false" />
</service-builder>
1
From service.xml to remote services generation
1 2 3
@denissignoretto / #LRIS2015
Time for Coding !
1.create a maven parent pom project
2.add service builder (sb) module using liferay sb archetype
3.create/edit file WEB-INFservice.xml within portlet sub-module
4.generate the first version of the service (empty impl)
mvn liferay:build-service (ant build-service using sdk)
5.generate wsdd (just once)
mvn liferay:build-wsdd (ant build-wsdd using sdk)
6.create models of business services within service sub-module
7.create/edit remote service methods in *ServiceImpl classes
8.regenerate services
mvn liferay:build-service
9.goto 7 until completion
10.mvn clean install liferay:deploy
main steps to generate remote services
1
1 2 3
@denissignoretto / #LRIS2015
Liferay
Mobile SDK
2
1 2 3
StoreDashboard
@denissignoretto / #LRIS2015
1 2 3
Liferay Mobile SDK is a Multi Module
Project for Android & iOS
 SDK Builder
 Set of Native API
 Push Notifications API
 OAuth Authentication API
Mobile SDK
Mobile SDK API
Autogen Portal
Services API
Push &
OAuth API
Autogen Custom
Services API
Screenlet
Screenlet
Screenlet
...
Third Party Libs
Custom
Devel
@denissignoretto / #LRIS2015
1 2 3
Mobile SDK Builder
Mobile SDK API
Autogen Portal
Services API
Push &
OAuth API
Autogen Custom
Services API
Screenlet
Screenlet
Screenlet
...
Third Party Libs
Custom
DevelSDK Builder is a Native API Generator
for JSONWS Services (*)
 SDK Builder
 Set of Native API
 Push Notifications API
 OAuth Authentication API
Liferay Supports: Android e iOS
(*) Requires Liferay 6.2 or higher
@denissignoretto / #LRIS2015
Being a template based API Generator, it was possible support
other platforms:
 Titanium SDK (supported by SMC, maintained by Pier Paolo Ramon)
 Cordova (supported by Salva Tejero)
 Windows (supported by Andrea Di Giorgi)
Mobile SDK Builder
1 2 3
@denissignoretto / #LRIS2015
1 2 3
Liferay Mobile SDK offer a set of native
API:
Mobile SDK Components:
 SDK Builder
 Set of Native API
 Push Notifications API
 OAuth Authentication API
SDK Native API
Mobile SDK API
Autogen Portal
Services API
Push &
OAuth API
Autogen Custom
Services API
Screenlet
Screenlet
Screenlet
...
Third Party Libs
Custom
Devel
@denissignoretto / #LRIS2015
Mobile SDK – Native API
• Authentication
• Remote services calls
• Portal Services
• Custom Services
• Exception handling
• JSON parsing
• Sync/Async calls
• Batch calls
• Manage binaries
1 2 3
Liferay Mobile SDK offer a set of native
API:
Mobile SDK Components:
 SDK Builder
 Set of Native API
 Push Notifications API
 OAuth Authentication API
@denissignoretto / #LRIS2015
Mobile SDK – Push API
• Create a Project on
• Google: GCM
• Apple Push Notif.
Service
• API to register a Device
• Portal Plugin wih server
side API to send Push from
your portlet
1 2 3
Liferay Push Notification API
@denissignoretto / #LRIS2015
Time for Coding !
http://localhost:8080/remote-services-plugin-portlet/api/jsonws?discover
liferay-${your_portlet_context}-android-sdk-${version}.jar
SDK Builder: from discovery service to services native API generation
2
1 2 3
@denissignoretto / #LRIS2015
Service API Generation
1) git clone https://www.github.com/liferay/liferay-mobile-sdk.git
2)from the root folder:
a) ./gradlew createModule -P=all
o Context: /custom-remote-service-portlet
o Platforms: android,ios
o Server URL: http://localhost:8080
o Filter:
o Portal Version: 62 (appended to the end of package name)
o Module Version: 1.0.0
o Package Name: it.denissignoretto.liferay.mobile.sdk.android
o Pom Description: Android SDK API
3)check modules/${your_portlet_context} folder
a) generated code to android/src/gen/java and ios/Source)
4)Build & Package generated sources
a) cd modules/${your_portlet_context}
b) ../../gradlew generate
c) ../../gradlew jar (or zip for iOS)
5) liferay-${your_portlet_context}-android-sdk-${version}.jar file is
written to your android/build/libs folder
Generation of remote service API for Android
2
1 2 3
@denissignoretto / #LRIS2015
1 2 3
Create Dashboard w Native API
Store Dashboard
Creation
2
StoreDashboard
@denissignoretto / #LRIS2015
1 2 3
Dashboard w Native API
Third Party Libs
Custom
Devel
Mobile SDK API
Portal Services
API
Push &
OAuth API
Custom Services API
Screenlet
Screenlet
Screenlet
...
Custom Devel
+
Generated Services API
+
LR Mobile SDK
2
@denissignoretto / #LRIS2015
Authentication
SessionImpl & Authentication API
2
1 2 3
import com.liferay.mobile.android.auth.basic.BasicAuthentication;
import com.liferay.mobile.android.service.Session;
import com.liferay.mobile.android.service.SessionImpl;
...
// Authenticated Session
Session session = new SessionImpl("http://10.0.2.2:8080",
new BasicAuthentication("test@liferay.com", "test"));
// Unauthenticated Session
Session session = new SessionImpl("http://10.0.2.2:8080");
@denissignoretto / #LRIS2015
Service Call Invocation
Invoke Remote Services through generated services API
2
1 2 3
1) Create Session
2) Import Services you need
3) Create a Service Object
4) Invoke service Methods
...
InventoryService inventoryService = new InventoryService(session);
JSONObject response = inventoryService.getStoreInventoryData(storeId);
...
@denissignoretto / #LRIS2015
Batch Call Invocation
Invoke multiple services with a single network call
2
1 2 3
BatchSessionImpl batchSession = new BatchSessionImpl(session);
FinanceService financeService = new FinanceService(batchSession);
InventoryService inventoryService = new InventoryService(batchSession);
IncentiveService incentiveService = new IncentiveService(batchSession);
financeService.getStoreFinancialData(storeId);
inventoryService.getStoreInventoryData(storeId);
incentiveService.getStoreScore(storeId);
JSONArray batchResponse = batchSession.invoke();
@denissignoretto / #LRIS2015
Async Callback
Invoke remote serivce asynchronously
2
1 2 3
public class StoreDashboardCallback extends GenericCallback<StoreDashboardModel>
{ // implement tranform method handling JSON parsing yourself ... }
StoreDashboardCallback storeDashboardCallback = new StoreDashboardCallback() {
@Override
public void onFailure(Exception e) {
Log.e(_LOG_TAG, "Error retrieving Dashboard Data: " + e.getMessage(), e);
}
@Override
public void onSuccess(StoreDashboardModel storeDashboardModel) {
updateView(storeDashboardModel);
}
};
Session session = getSession(); // retrive session
session.setCallback(storeDashboardCallback);
DashboardServiceUtil.invokeStoreDashboard(session, STORE_ID, storeDashboardCallback);
(*) Usage of android.os.AsyncTask is an available option as well
@denissignoretto / #LRIS2015
Liferay
Screens
3
1 2 3
@denissignoretto / #LRIS2015
Liferay Screens is a set of reusable, themable, configurable and
extensible native visual components
Native visual components that
 Responds to specific “use cases” (like portlets !)
 Can be extended to and customized (UI & Logic)
 Fully compatible with standard development tools for iOS and Android
 Backend agnostic: you can use screenlets with an existing/custom non-
Liferay backend
Screens offer a base framework to create your own screenlet !
1 2 3
Liferay Screens
@denissignoretto / #LRIS2015
Liferay Screens
 Login (Sign In)
 Sign Up
 Forgot password
 User Portrait
 Push Notifications
 DDL forms
 Web Content
 Asset Lists
 Filtered Assets
Available Screenlets (v1.2)
From v 1.2
Offline Support Available (!)
1 2 3
@denissignoretto / #LRIS2015
 A Screenlet embeds
 Data Service Access (local, remote or both)
 Use Case Business Logic & Model Entities
 Presentation View & Presentation Logic
 Each Screenlet can support many configuration options to
customize Login and UI
1 2 3
Liferay Screens
@denissignoretto / #LRIS2015
Architecture of Screenlet for Android
LR Screens Architecture
class for all Liferay Portal interactions
and use cases that a Screenlet supports
(use case business logic).
Can use local and remote datasource
(Include an InteractorASycnTaskCallback)
base classes for
developing other Screens
components
Java Class that act as
“Visual Component”
for inserting into any
activity or fragment
hierarchy
A set of layouts and
custom view classes that
Present Screenlets to
the user
1 2 3
@denissignoretto / #LRIS2015
The Default Viewset is included as part of the Screens for
Android / iOS Library
Available additional ViewSet
 Material
 Westeros (Demo)
… or you can build your own !
Liferay Screens Viewset
1 2 3
@denissignoretto / #LRIS2015
Time for Coding !3
Adding User Autentication
Login Screenlet
1 2 3
@denissignoretto / #LRIS2015
1 2 3
Time for Coding
Third Party Libs
Custom
Devel
Mobile SDK API
Portal
Services
API
Push &
OAuth API
Custom Services API
Screenlet
Login
Screenlet
...
Adding User Autentication
Login Screenlet
3
@denissignoretto / #LRIS2015
Liferay Screens Dependency
In build.gradle add liferay screens dependency
dependencies {
...
compile 'com.liferay.mobile:liferay-screens:1.2.3' (*)
}
(*) https://bintray.com/liferay/liferay-mobile/liferay-screens/view
It dedends on:
- liferay-android-sdk 2.0.2
- liferay-push 1.0.7
- liferay-android-oauth 1.0.3
- (other android/third party libs)
Inclusion of Liferay Screens Dependency
3
1 2 3
@denissignoretto / #LRIS2015
Liferay Screens Configuration
Screenlet use LiferayServerContext a singleton object init from
server_context.xml
In your resource/value directory create/edit your server_context.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="liferay_server">http://SERVER:8080</string>
<integer name="liferay_company_id">YOUR_COMPANY_ID</integer>
<integer name="liferay_group_id">SITE_GROUP_ID</integer>
</resources>
Server Configuration for Liferay Screens
3
1 2 3
@denissignoretto / #LRIS2015
Add Liferay Login Screenlet
Add a Login Activity and in related activity_<activiti_name>.xml file add
the Login Screenlet Component with following parameters:
...
<com.liferay.mobile.screens.auth.login.LoginScreenlet
android:id="@+id/login_default"
android:layout_width="match_parent"
android:layout_height="match_parent"
liferay:basicAuthMethod=“screen_name"/>
...
Add Liferay Login Screenlet to Main Activity
3
1 2 3
@denissignoretto / #LRIS2015
Liferay Liferay Login Screenlet
All screenlets supports configuration options through xml.
Liferay Login Screenlet supports the following:
liferay:basicAuthMethod
liferay:companyId
liferay:credentialsStore
liferay:oauthConsumerKey
liferay:oauthConsumerSecret
liferay:layoutId
Customize Behaviour with Attributes
3
1 2 3
@denissignoretto / #LRIS2015
Liferay Liferay Login Screenlet
In your build.gradle
dependencies {
...
compile 'com.liferay.mobile:liferay-material-viewset:1.2.3‘
...
}
Replace layoutId with @layout/login_material
<com.liferay.mobile.screens.auth.login.LoginScreenlet
android:layout_width="match_parent"
android:layout_height="match_parent"
liferay:basicAuthMethod=“screen_name"
liferay:layoutId="@layout/login_material"/>
Customize Layout, with Material viewset
3
1 2 3
@denissignoretto / #LRIS2015
Liferay Push Screenlet
Push Screenlet
3
1 2 3
(omitted) Add to manifest Push Screenlet Service and Receiver to your
Android manifest file
public class NotificationsActivity extends AbstractPushActivity {
@Override
protected void onPushNotificationReceived(final JSONObject jsonObject)
{ ... }
@Override
protected void onErrorRegisteringPush(final String message, final
Exception e) { ... }
@Override
protected String getSenderId() {
return SENDER_ID; // identifier given by Google GCM
}
@denissignoretto / #LRIS2015
Done !
@denissignoretto / #LRIS2015
Conclusions
Third Party Libs
Custom
Devel
Third Party Libs
Custom
Devel
Mobile SDK API
Portal
Services API
Push &
OAuth API
Custom Services API
Screenlet
Screenlet
Screenlet
...
Pre “Liferay Mobile Era” Post “Liferay Mobile Era”
@denissignoretto / #LRIS2015
Conclusions
Mobile Development with Liferay Mobile is
 Faster
 Easyer to develop & maintain
 More and more powerful
 Offer a better support for testing/tested components
@denissignoretto / #LRIS2015
Conclusions
You can build new valued mobile apps
leveraging whole functionalities that Liferay offers, like:
 Web Contents, Documents & Videos, Blogs, Wiki, Calendar, ecc.
 Search & Categorization
 Related & Targeted contents
 Engagement & Notifications: email, push & portal
 Social/collaboration info: comments, rating, flagged, relations, …
 Workflow & Mobility
@denissignoretto / #LRIS2015
Questions ?
Thanks !!!
For Feedback
denis.signoretto@intesys.it
@denissignoretto
?

Contenu connexe

Tendances

Integrating Alfresco with Liferay Portal for Document-Centric Use Cases
Integrating Alfresco with Liferay Portal for Document-Centric Use CasesIntegrating Alfresco with Liferay Portal for Document-Centric Use Cases
Integrating Alfresco with Liferay Portal for Document-Centric Use Cases
rivetlogic
 
01/2009 - Portral development with liferay
01/2009 - Portral development with liferay01/2009 - Portral development with liferay
01/2009 - Portral development with liferay
daveayan
 
Benefits of using liferay
Benefits of using liferay Benefits of using liferay
Benefits of using liferay
SKALI Group
 

Tendances (20)

Liferay and Cloud
Liferay and CloudLiferay and Cloud
Liferay and Cloud
 
Creating Better Customer and Employee Experiences with Liferay Portal and Cra...
Creating Better Customer and Employee Experiences with Liferay Portal and Cra...Creating Better Customer and Employee Experiences with Liferay Portal and Cra...
Creating Better Customer and Employee Experiences with Liferay Portal and Cra...
 
Introduction to Portlets using Liferay Portal (Part 2)
Introduction to Portlets using Liferay Portal (Part 2)Introduction to Portlets using Liferay Portal (Part 2)
Introduction to Portlets using Liferay Portal (Part 2)
 
Integrating Alfresco with Liferay Portal for Document-Centric Use Cases
Integrating Alfresco with Liferay Portal for Document-Centric Use CasesIntegrating Alfresco with Liferay Portal for Document-Centric Use Cases
Integrating Alfresco with Liferay Portal for Document-Centric Use Cases
 
Liferay 7
Liferay 7Liferay 7
Liferay 7
 
Liferay DXP Training
Liferay DXP TrainingLiferay DXP Training
Liferay DXP Training
 
Liferay portal – moving beyond content management
Liferay portal – moving beyond content managementLiferay portal – moving beyond content management
Liferay portal – moving beyond content management
 
Liferay with xebia
Liferay with xebiaLiferay with xebia
Liferay with xebia
 
Liferay on docker
Liferay on dockerLiferay on docker
Liferay on docker
 
OOD Principles and Patterns
OOD Principles and PatternsOOD Principles and Patterns
OOD Principles and Patterns
 
Liferay v. Drupal: Pound for Pound @ Liferay Symposium 2014 - Findings from t...
Liferay v. Drupal: Pound for Pound @ Liferay Symposium 2014 - Findings from t...Liferay v. Drupal: Pound for Pound @ Liferay Symposium 2014 - Findings from t...
Liferay v. Drupal: Pound for Pound @ Liferay Symposium 2014 - Findings from t...
 
Liferay Developer Best Practices for a Successful Deployment
Liferay Developer Best Practices for a Successful DeploymentLiferay Developer Best Practices for a Successful Deployment
Liferay Developer Best Practices for a Successful Deployment
 
01/2009 - Portral development with liferay
01/2009 - Portral development with liferay01/2009 - Portral development with liferay
01/2009 - Portral development with liferay
 
Liferay portals in real projects
Liferay portals  in real projectsLiferay portals  in real projects
Liferay portals in real projects
 
J2EE Technology Mapping-21-may-2014
J2EE Technology Mapping-21-may-2014J2EE Technology Mapping-21-may-2014
J2EE Technology Mapping-21-may-2014
 
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik HarabiEclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
 
Benefits of using liferay
Benefits of using liferay Benefits of using liferay
Benefits of using liferay
 
Liferay dxp – the good, the bad and the ugly
Liferay dxp – the good, the bad and the uglyLiferay dxp – the good, the bad and the ugly
Liferay dxp – the good, the bad and the ugly
 
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
 
Liferay as solution for legacy applications
Liferay as solution for legacy applicationsLiferay as solution for legacy applications
Liferay as solution for legacy applications
 

Similaire à Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens

Android presentation
Android presentationAndroid presentation
Android presentation
Imam Raza
 
iOS-iPhone documentation
iOS-iPhone documentationiOS-iPhone documentation
iOS-iPhone documentation
Raj Dubey
 
Hybrid Mobile Apps - Meetup
Hybrid Mobile Apps - MeetupHybrid Mobile Apps - Meetup
Hybrid Mobile Apps - Meetup
Sanjay Patel
 

Similaire à Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens (20)

Android presentation
Android presentationAndroid presentation
Android presentation
 
FIWARE IoT Proposal & Community
FIWARE IoT Proposal & CommunityFIWARE IoT Proposal & Community
FIWARE IoT Proposal & Community
 
Outsmarting smartphones
Outsmarting smartphonesOutsmarting smartphones
Outsmarting smartphones
 
Shankar
ShankarShankar
Shankar
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Building Cross Platform Mobile Apps Dev Tools, MBaaS, Architecture, APIs
Building Cross Platform Mobile Apps Dev Tools, MBaaS, Architecture, APIsBuilding Cross Platform Mobile Apps Dev Tools, MBaaS, Architecture, APIs
Building Cross Platform Mobile Apps Dev Tools, MBaaS, Architecture, APIs
 
Android Basics
Android BasicsAndroid Basics
Android Basics
 
Anuradha_Resume_2016
Anuradha_Resume_2016Anuradha_Resume_2016
Anuradha_Resume_2016
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
 
IThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOpsIThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOps
 
10 Key Criteria for Mobile Platform Selection
10 Key Criteria for Mobile Platform Selection10 Key Criteria for Mobile Platform Selection
10 Key Criteria for Mobile Platform Selection
 
iOS-iPhone documentation
iOS-iPhone documentationiOS-iPhone documentation
iOS-iPhone documentation
 
Api-First service design
Api-First service designApi-First service design
Api-First service design
 
Android task manager project presentation
Android task manager project presentationAndroid task manager project presentation
Android task manager project presentation
 
Rhomobile 5.5 Release Notes
Rhomobile 5.5 Release NotesRhomobile 5.5 Release Notes
Rhomobile 5.5 Release Notes
 
Android development classes in chandigarh : Big Boxx Academy
Android development classes in chandigarh : Big Boxx AcademyAndroid development classes in chandigarh : Big Boxx Academy
Android development classes in chandigarh : Big Boxx Academy
 
Mobile Web Apps and the Intel® XDK
Mobile Web Apps and the Intel® XDKMobile Web Apps and the Intel® XDK
Mobile Web Apps and the Intel® XDK
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)
 
Hybrid Mobile Apps - Meetup
Hybrid Mobile Apps - MeetupHybrid Mobile Apps - Meetup
Hybrid Mobile Apps - Meetup
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 

Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens

  • 1. LR Mobile SDK & LR Screens Building an Android App with Liferay Denis Signoretto, Solution Architect and Project Manager at Intesys S.r.l.
  • 2. @denissignoretto / #LRIS2015 Intro: Liferay & Mobile Past, present & future  Pre 2014 – Revamped remote services (JSONWS)  2014 – Liferay Mobile SDK API 1.0  2015 – Liferay Screens ver. 1.0, 1.1, 1.2  What’s next ?  Just wait for Italy Symposium tomorrow 
  • 3. @denissignoretto / #LRIS2015 App Story We’ re going to show a sample Android Native App build with Liferay Mobile Frameworks The app allows a company store manager to take under control the performance of his store Dashboard Info:  Sales Amount + % Variation from Last Year  Profit Amount + % Variation from Last Year  Hands On / In Order Inventory  Days in Stock  Incentive: Store Position StoreDashboard
  • 4. @denissignoretto / #LRIS2015 Building the App: 3 Steps 1 2 3 Data Access Remote Services Store Dashboard User/Pass Authentication StoreDashboard StoreDashboard
  • 5. @denissignoretto / #LRIS2015 3 Main Liferay Ingredients 3 JSONWS API Liferay Remote Services Liferay Mobile SDK Liferay Screens
  • 6. @denissignoretto / #LRIS2015 Liferay as Mobile Backend Liferay as a Mobile Backend Liferay Portal Finacial ERP/Stock Inventrory Incentive JSONWS Remote Services StoreDashboard
  • 9. @denissignoretto / #LRIS2015 JSONWS Remote Services Liferay can expose via SOAP & JSON web services SOAP (AXIS): http://localhost:8080/api/axis JSON (JSONWS): http://localhost:8080/api/jsonws JSONWS are JSON Restful Remote Services  Liferay already expose all its services  You can generate similar remote services for your custom entities as well (!) 1 2 3
  • 10. @denissignoretto / #LRIS2015  Liferay JSONWS stack:  Authentication  Security  IP Layer, Auth/Verification Layer, Permission Layer  Batch Calls  Nested Calls  JSON Serialization JSONWS Remote Services 1 2 3
  • 11. @denissignoretto / #LRIS2015 JSONWS are annotated service classes (LR 6.2)  Do not rely on Service Builder but it does a lot of work for you !!!  Service Builder is a two step code generator:  From service.xml file → Interfaces API Generation + “Empty” Impl  Modified Impl → updated API Interfaces  Exposing remote services  By Default plugin remote services are not exposed,  Liferay expose remote services on WSDD generation  when /WEB-INF/server-config.wsdd if found in your plugin JSONWS Remote Services 1 2 3
  • 12. @denissignoretto / #LRIS2015 JSONWebService Annotation @JSONWebService public interface UserService { ... } *ServiceImpl annotated methods can override interface annotated methods Public Method @AccessControlled(guestAccessEnabled = true) Customize HTTP Method Name and URL @JSONWebService (value = "add-board-wow", method = "PUT") Ignoring a Method @JSONWebService (mode = JSONWebServiceMode.IGNORE) ... Your remote service methods should be implemented in *ServiceImpl classes JSONWS Annotations 1 2 3 JSONWS Remote Services
  • 13. @denissignoretto / #LRIS2015 Time for Coding service.xml http://localhost:8080/api/jsonws/remote-services-plugin- portlet.<service>/... From service.xml to remote services generation 1 1 2 3
  • 14. @denissignoretto / #LRIS2015 Time for Coding <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd"> <service-builder package-path="it.intesys.liferay.lris2015"> <author>Denis Signoretto</author> <namespace>IT_INTESYS_LRIS_SAMPLE</namespace> <entity name="finance" local-service="false" remote-service="true" uuid="false" /> <entity name="inventory" local-service="false" remote-service="true" uuid="false" /> <entity name="incentive" local-service="false" remote-service="true" uuid="false" /> </service-builder> 1 From service.xml to remote services generation 1 2 3
  • 15. @denissignoretto / #LRIS2015 Time for Coding ! 1.create a maven parent pom project 2.add service builder (sb) module using liferay sb archetype 3.create/edit file WEB-INFservice.xml within portlet sub-module 4.generate the first version of the service (empty impl) mvn liferay:build-service (ant build-service using sdk) 5.generate wsdd (just once) mvn liferay:build-wsdd (ant build-wsdd using sdk) 6.create models of business services within service sub-module 7.create/edit remote service methods in *ServiceImpl classes 8.regenerate services mvn liferay:build-service 9.goto 7 until completion 10.mvn clean install liferay:deploy main steps to generate remote services 1 1 2 3
  • 16. @denissignoretto / #LRIS2015 Liferay Mobile SDK 2 1 2 3 StoreDashboard
  • 17. @denissignoretto / #LRIS2015 1 2 3 Liferay Mobile SDK is a Multi Module Project for Android & iOS  SDK Builder  Set of Native API  Push Notifications API  OAuth Authentication API Mobile SDK Mobile SDK API Autogen Portal Services API Push & OAuth API Autogen Custom Services API Screenlet Screenlet Screenlet ... Third Party Libs Custom Devel
  • 18. @denissignoretto / #LRIS2015 1 2 3 Mobile SDK Builder Mobile SDK API Autogen Portal Services API Push & OAuth API Autogen Custom Services API Screenlet Screenlet Screenlet ... Third Party Libs Custom DevelSDK Builder is a Native API Generator for JSONWS Services (*)  SDK Builder  Set of Native API  Push Notifications API  OAuth Authentication API Liferay Supports: Android e iOS (*) Requires Liferay 6.2 or higher
  • 19. @denissignoretto / #LRIS2015 Being a template based API Generator, it was possible support other platforms:  Titanium SDK (supported by SMC, maintained by Pier Paolo Ramon)  Cordova (supported by Salva Tejero)  Windows (supported by Andrea Di Giorgi) Mobile SDK Builder 1 2 3
  • 20. @denissignoretto / #LRIS2015 1 2 3 Liferay Mobile SDK offer a set of native API: Mobile SDK Components:  SDK Builder  Set of Native API  Push Notifications API  OAuth Authentication API SDK Native API Mobile SDK API Autogen Portal Services API Push & OAuth API Autogen Custom Services API Screenlet Screenlet Screenlet ... Third Party Libs Custom Devel
  • 21. @denissignoretto / #LRIS2015 Mobile SDK – Native API • Authentication • Remote services calls • Portal Services • Custom Services • Exception handling • JSON parsing • Sync/Async calls • Batch calls • Manage binaries 1 2 3 Liferay Mobile SDK offer a set of native API: Mobile SDK Components:  SDK Builder  Set of Native API  Push Notifications API  OAuth Authentication API
  • 22. @denissignoretto / #LRIS2015 Mobile SDK – Push API • Create a Project on • Google: GCM • Apple Push Notif. Service • API to register a Device • Portal Plugin wih server side API to send Push from your portlet 1 2 3 Liferay Push Notification API
  • 23. @denissignoretto / #LRIS2015 Time for Coding ! http://localhost:8080/remote-services-plugin-portlet/api/jsonws?discover liferay-${your_portlet_context}-android-sdk-${version}.jar SDK Builder: from discovery service to services native API generation 2 1 2 3
  • 24. @denissignoretto / #LRIS2015 Service API Generation 1) git clone https://www.github.com/liferay/liferay-mobile-sdk.git 2)from the root folder: a) ./gradlew createModule -P=all o Context: /custom-remote-service-portlet o Platforms: android,ios o Server URL: http://localhost:8080 o Filter: o Portal Version: 62 (appended to the end of package name) o Module Version: 1.0.0 o Package Name: it.denissignoretto.liferay.mobile.sdk.android o Pom Description: Android SDK API 3)check modules/${your_portlet_context} folder a) generated code to android/src/gen/java and ios/Source) 4)Build & Package generated sources a) cd modules/${your_portlet_context} b) ../../gradlew generate c) ../../gradlew jar (or zip for iOS) 5) liferay-${your_portlet_context}-android-sdk-${version}.jar file is written to your android/build/libs folder Generation of remote service API for Android 2 1 2 3
  • 25. @denissignoretto / #LRIS2015 1 2 3 Create Dashboard w Native API Store Dashboard Creation 2 StoreDashboard
  • 26. @denissignoretto / #LRIS2015 1 2 3 Dashboard w Native API Third Party Libs Custom Devel Mobile SDK API Portal Services API Push & OAuth API Custom Services API Screenlet Screenlet Screenlet ... Custom Devel + Generated Services API + LR Mobile SDK 2
  • 27. @denissignoretto / #LRIS2015 Authentication SessionImpl & Authentication API 2 1 2 3 import com.liferay.mobile.android.auth.basic.BasicAuthentication; import com.liferay.mobile.android.service.Session; import com.liferay.mobile.android.service.SessionImpl; ... // Authenticated Session Session session = new SessionImpl("http://10.0.2.2:8080", new BasicAuthentication("test@liferay.com", "test")); // Unauthenticated Session Session session = new SessionImpl("http://10.0.2.2:8080");
  • 28. @denissignoretto / #LRIS2015 Service Call Invocation Invoke Remote Services through generated services API 2 1 2 3 1) Create Session 2) Import Services you need 3) Create a Service Object 4) Invoke service Methods ... InventoryService inventoryService = new InventoryService(session); JSONObject response = inventoryService.getStoreInventoryData(storeId); ...
  • 29. @denissignoretto / #LRIS2015 Batch Call Invocation Invoke multiple services with a single network call 2 1 2 3 BatchSessionImpl batchSession = new BatchSessionImpl(session); FinanceService financeService = new FinanceService(batchSession); InventoryService inventoryService = new InventoryService(batchSession); IncentiveService incentiveService = new IncentiveService(batchSession); financeService.getStoreFinancialData(storeId); inventoryService.getStoreInventoryData(storeId); incentiveService.getStoreScore(storeId); JSONArray batchResponse = batchSession.invoke();
  • 30. @denissignoretto / #LRIS2015 Async Callback Invoke remote serivce asynchronously 2 1 2 3 public class StoreDashboardCallback extends GenericCallback<StoreDashboardModel> { // implement tranform method handling JSON parsing yourself ... } StoreDashboardCallback storeDashboardCallback = new StoreDashboardCallback() { @Override public void onFailure(Exception e) { Log.e(_LOG_TAG, "Error retrieving Dashboard Data: " + e.getMessage(), e); } @Override public void onSuccess(StoreDashboardModel storeDashboardModel) { updateView(storeDashboardModel); } }; Session session = getSession(); // retrive session session.setCallback(storeDashboardCallback); DashboardServiceUtil.invokeStoreDashboard(session, STORE_ID, storeDashboardCallback); (*) Usage of android.os.AsyncTask is an available option as well
  • 32. @denissignoretto / #LRIS2015 Liferay Screens is a set of reusable, themable, configurable and extensible native visual components Native visual components that  Responds to specific “use cases” (like portlets !)  Can be extended to and customized (UI & Logic)  Fully compatible with standard development tools for iOS and Android  Backend agnostic: you can use screenlets with an existing/custom non- Liferay backend Screens offer a base framework to create your own screenlet ! 1 2 3 Liferay Screens
  • 33. @denissignoretto / #LRIS2015 Liferay Screens  Login (Sign In)  Sign Up  Forgot password  User Portrait  Push Notifications  DDL forms  Web Content  Asset Lists  Filtered Assets Available Screenlets (v1.2) From v 1.2 Offline Support Available (!) 1 2 3
  • 34. @denissignoretto / #LRIS2015  A Screenlet embeds  Data Service Access (local, remote or both)  Use Case Business Logic & Model Entities  Presentation View & Presentation Logic  Each Screenlet can support many configuration options to customize Login and UI 1 2 3 Liferay Screens
  • 35. @denissignoretto / #LRIS2015 Architecture of Screenlet for Android LR Screens Architecture class for all Liferay Portal interactions and use cases that a Screenlet supports (use case business logic). Can use local and remote datasource (Include an InteractorASycnTaskCallback) base classes for developing other Screens components Java Class that act as “Visual Component” for inserting into any activity or fragment hierarchy A set of layouts and custom view classes that Present Screenlets to the user 1 2 3
  • 36. @denissignoretto / #LRIS2015 The Default Viewset is included as part of the Screens for Android / iOS Library Available additional ViewSet  Material  Westeros (Demo) … or you can build your own ! Liferay Screens Viewset 1 2 3
  • 37. @denissignoretto / #LRIS2015 Time for Coding !3 Adding User Autentication Login Screenlet 1 2 3
  • 38. @denissignoretto / #LRIS2015 1 2 3 Time for Coding Third Party Libs Custom Devel Mobile SDK API Portal Services API Push & OAuth API Custom Services API Screenlet Login Screenlet ... Adding User Autentication Login Screenlet 3
  • 39. @denissignoretto / #LRIS2015 Liferay Screens Dependency In build.gradle add liferay screens dependency dependencies { ... compile 'com.liferay.mobile:liferay-screens:1.2.3' (*) } (*) https://bintray.com/liferay/liferay-mobile/liferay-screens/view It dedends on: - liferay-android-sdk 2.0.2 - liferay-push 1.0.7 - liferay-android-oauth 1.0.3 - (other android/third party libs) Inclusion of Liferay Screens Dependency 3 1 2 3
  • 40. @denissignoretto / #LRIS2015 Liferay Screens Configuration Screenlet use LiferayServerContext a singleton object init from server_context.xml In your resource/value directory create/edit your server_context.xml file <?xml version="1.0" encoding="utf-8"?> <resources> <string name="liferay_server">http://SERVER:8080</string> <integer name="liferay_company_id">YOUR_COMPANY_ID</integer> <integer name="liferay_group_id">SITE_GROUP_ID</integer> </resources> Server Configuration for Liferay Screens 3 1 2 3
  • 41. @denissignoretto / #LRIS2015 Add Liferay Login Screenlet Add a Login Activity and in related activity_<activiti_name>.xml file add the Login Screenlet Component with following parameters: ... <com.liferay.mobile.screens.auth.login.LoginScreenlet android:id="@+id/login_default" android:layout_width="match_parent" android:layout_height="match_parent" liferay:basicAuthMethod=“screen_name"/> ... Add Liferay Login Screenlet to Main Activity 3 1 2 3
  • 42. @denissignoretto / #LRIS2015 Liferay Liferay Login Screenlet All screenlets supports configuration options through xml. Liferay Login Screenlet supports the following: liferay:basicAuthMethod liferay:companyId liferay:credentialsStore liferay:oauthConsumerKey liferay:oauthConsumerSecret liferay:layoutId Customize Behaviour with Attributes 3 1 2 3
  • 43. @denissignoretto / #LRIS2015 Liferay Liferay Login Screenlet In your build.gradle dependencies { ... compile 'com.liferay.mobile:liferay-material-viewset:1.2.3‘ ... } Replace layoutId with @layout/login_material <com.liferay.mobile.screens.auth.login.LoginScreenlet android:layout_width="match_parent" android:layout_height="match_parent" liferay:basicAuthMethod=“screen_name" liferay:layoutId="@layout/login_material"/> Customize Layout, with Material viewset 3 1 2 3
  • 44. @denissignoretto / #LRIS2015 Liferay Push Screenlet Push Screenlet 3 1 2 3 (omitted) Add to manifest Push Screenlet Service and Receiver to your Android manifest file public class NotificationsActivity extends AbstractPushActivity { @Override protected void onPushNotificationReceived(final JSONObject jsonObject) { ... } @Override protected void onErrorRegisteringPush(final String message, final Exception e) { ... } @Override protected String getSenderId() { return SENDER_ID; // identifier given by Google GCM }
  • 46. @denissignoretto / #LRIS2015 Conclusions Third Party Libs Custom Devel Third Party Libs Custom Devel Mobile SDK API Portal Services API Push & OAuth API Custom Services API Screenlet Screenlet Screenlet ... Pre “Liferay Mobile Era” Post “Liferay Mobile Era”
  • 47. @denissignoretto / #LRIS2015 Conclusions Mobile Development with Liferay Mobile is  Faster  Easyer to develop & maintain  More and more powerful  Offer a better support for testing/tested components
  • 48. @denissignoretto / #LRIS2015 Conclusions You can build new valued mobile apps leveraging whole functionalities that Liferay offers, like:  Web Contents, Documents & Videos, Blogs, Wiki, Calendar, ecc.  Search & Categorization  Related & Targeted contents  Engagement & Notifications: email, push & portal  Social/collaboration info: comments, rating, flagged, relations, …  Workflow & Mobility
  • 49. @denissignoretto / #LRIS2015 Questions ? Thanks !!! For Feedback denis.signoretto@intesys.it @denissignoretto ?