MobileFirst Plugin for Xamarin Forms
Plugin designed for connections with MFP servers (IBM Mobile Platform First). With it you can make calls Procedures, send logs and connect / disconnect to the Push Notifications service
Setup
- Available on NuGet: https://www.nuget.org/packages/Plugin.MobileFirst/
- Install into your PCL project and Client projects.
- Install IBM Mobile First SDK Component into your Client projects IBM MobileFirst SDK
Built with C# 6 features, you must be running VS 2015 or Xamarin Studio to compile. NuGets of course work everywhere!
Follow Me
- Twitter: @jbravobr
- Blog: Stx.blog.br
What is this?
This is my PCL Plugin from IBM Mobile First Platform to Xamarin Forms
Contribute
My Plugins for Xamarin are completely open source and I encourage and accept pull requests! So please help out in any ways you can:
- Report Bugs: Open an Issue
- Submit Feature Requests: Open an Issue
- Fix a Bug or Add Feature: Send a Pull Request
- Create your Own Plugin : Learn How
Platform Support
Platform | Supported | Version |
---|---|---|
Xamarin.iOS | Yes | iOS 6+ |
Xamarin.iOS Unified | Yes | iOS 6+ |
Xamarin.Android | Yes | API 10+ |
Windows Phone Silverlight | No | |
Windows Phone RT | No | |
Windows Store RT | No | |
Windows 10 UWP | No | |
Xamarin.Mac | No |
API Usage
Call CrossMobileFirst.Current from any project or PCL to gain access to APIs.
Init (iOS)
/// <summary>
/// Init Method for iOS
/// </summary>
void Init();
Init (Android)
/// <summary>
/// Init Method for Android
/// </summary>
/// <param name="activity">Is the Android App Activity</param>
void Init(object activity);
ConnectAsync
/// <summary>
/// Make a new async connection with the MFP Server
/// </summary>
/// <returns>WorlightResult</returns>
Task<WorklightResult> ConnectAsync();
RestInvokeAsync
/// <summary>
/// Make a async Rest Invoke to a procedure from the MFP Server
/// </summary>
/// <param name="adapterName">The Name of the Adapter</param>
/// <param name="adapterProcedureName">The Name of the Procedure</param>
/// <param name="methodType">The Type of HTTP Verb</param>
/// <param name="parameters">JSON parameters</param>
/// <returns>WorlightResult</returns>
Task<WorklightResult> RestInvokeAsync(string adapterName, string adapterProcedureName, string methodType, object[] parameters);
InvokeAsync
/// <summary>
/// Make a async call to a procedure from the MFP Server
/// </summary>
/// <param name="adapterName">The Adapter name</param>
/// <param name="adapterProcedureName">The Procedure name</param>
/// <param name="parameters">JSON parameters</param>
/// <returns>WorlightResult</returns>
Task<WorklightResult> InvokeAsync(string adapterName, string adapterProcedureName, object[] parameters);
SendActivityAsync
/// <summary>
/// Use this to send logs and other data to the MFP Server
/// </summary>
/// <param name="data">Data to be sent to the MFP server</param>
/// <returns>WorlightResult</returns>
Task<WorklightResult> SendActivityAsync(string data);
SubscribeAsync
/// <summary>
/// Do a new Subscription on the Push Notification server
/// </summary>
/// <returns>WorlightResult</returns>
Task<WorklightResult> SubscribeAsync();
UnSubscribeAsync
/// <summary>
/// Undo a existing subscription on the Push Notification server
/// </summary>
/// <returns></returns>
Task<WorklightResult> UnSubscribeAsync();
IMPORTANT
Android: YOU NEED TO INITIALIZE THE PLUGIN FROM YOUR MAIN ACTIVITY AS THAT:
CrossMobileFirst.Current.Init(this);
iOS: YOU NEED TO INITIALIZE THE PLUGIN FORM YOUR AppDelegate.cs AS THAT:
CrossMobileFirst.Current.Init();
DO NOT FORGET TO INSTALL THE IBM MOBILEFIRST SDK (LINK ABOVE) INTO YOUR CLIENTS PROJECTS
CONFIGURATIONS OF MFP SERVER
You will have to configurate correctly the Worklight Properties File. At ANDROID you will have to put at Assets Directory under the name wlclient.properties. At iOS you will have to put at the ROOT Directory of your Application under the name worklight.plist
Contributors
Thanks!
License
Licensed under MIT see License file.