-
Download the latest version of
Liferay.SDK.nupkg
. -
Within your C# project, install the NuGet as a local NuGet.
-
Start using it!
If you want to know other ways to install a NuGet package, please see this documentation.
If you are using Visual Studio, you can use the Package Manager UI to install the NuGet package as a dependency to your project. All versions are available at NuGet.org.
Each Liferay Mobile SDK is designed to work with a specific Liferay Portal version. Because of that, its version scheme reflects the compatible Liferay version.
For example, Liferay Mobile SDK 6.2.0.1 is built to work with Liferay Portal 6.2.0, while Liferay Mobile SDK 7.0.0 will work with Liferay Portal 7.0.0.
The fourth integer in the version (6.2.0.x) is related to internal Liferay Mobile SDK versions. For example, if a bug is found on 6.2.0.1, we will release a version called 6.2.0.2 with the bug fix.
This doesn't mean you can't support several Liferay versions in the same app though. You can add to your classpath both versions 6.2.0.1 and 7.0.0. There won't be conflicts because service classes packages are separated by their version number as well: V62, V70, V71, etc.
The Liferay Windows SDK is an almost line-by-line port of the Android version, so more detailed information about usage can be found at this page.
-
Create a
Session
with the user credentials:using Liferay.SDK; var session = new Session(new Uri("http://localhost:8080"), "test@liferay.com", "test");
-
Import the service you need, for example:
using Liferay.SDK.Service.V62.BlogsEntry;
-
Create a
BlogsEntryService
object and make a service call:var service = new BlogsEntryService(session); var entries = await service.GetGroupEntriesAsync(10184, 0, -1, -1);
Service methods are asynchronous and follow the async/await approach. Return types can be primitive types,
dynamic
objects orIEnumerable<dynamic>
collections. So, it is easy to navigate the results of the service calls and read the properties of the returned objects:foreach (var entry in entries) { Console.WriteLine(entry.title); }
The SDK allows sending requests using batch processing, which can be much more efficient in some cases. Read DLAppServiceTest.cs to find an example on how to create a batch of calls and send them all together.
There are some special cases in which service methods arguments are not
primitives. In these cases, you should use JsonObjectWrapper
. Read
OrderByComparatorTest.cs
and ServiceContextTest.cs
to find examples on how to use non-primitive arguments in service methods.
Some Liferay services require argument types such as byte arrays (byte[]
) and
Streams (System.IO.Stream
). Read DLAppServiceTest.cs
to find an example on how to send binary data to the portal.