{"id":19149929,"url":"https://github.com/harness/ff-xamarin-client-sdk","last_synced_at":"2025-05-07T04:44:50.545Z","repository":{"id":41971732,"uuid":"461791285","full_name":"harness/ff-xamarin-client-sdk","owner":"harness","description":"Xamarin SDK to integrate with Harness Feature Flag service","archived":false,"fork":false,"pushed_at":"2022-08-30T15:05:01.000Z","size":495,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-07T04:44:45.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-21T09:32:44.000Z","updated_at":"2023-06-02T16:20:34.000Z","dependencies_parsed_at":"2022-08-12T01:00:57.622Z","dependency_job_id":null,"html_url":"https://github.com/harness/ff-xamarin-client-sdk","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-xamarin-client-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-xamarin-client-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-xamarin-client-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-xamarin-client-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harness","download_url":"https://codeload.github.com/harness/ff-xamarin-client-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816520,"owners_count":21808702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T08:10:05.660Z","updated_at":"2025-05-07T04:44:50.519Z","avatar_url":"https://github.com/harness.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xamarin SDK For Harness Feature Flags\n\nUse this README to get started with our Feature Flags (FF) SDK for Xamarin. This guide outlines the basics of getting started with the SDK and provides a full code sample for you to try out.\n\nThis sample doesn't include configuration options, for in depth steps and configuring the SDK, for example, disabling streaming or using our Relay Proxy, see the [Xamarin SDK Reference](https://docs.harness.io/article/x9mh0o785u-xamarin-sdk-reference).\n\n\n\n## Requirements\n\nXamarin client uses Harness Binding library NuGet package for iOS and Android application.\nTo use this SDK, make sure you've:\n\n- Added reference Android binding library:\n\n```\nInstall-Package ff-android-xamarin-client-sdk -Version 0.5.4\n```\n\nNote: To be able to use the Android binding library the Google GSON bindings must be provided:\n\n```\nInstall-Package GoogleGson -Version 2.8.5\n```\n\n- Add reference iOS binding library:\n```\nInstall-Package ff-ios-xamarin-client-sdk -Version 0.5.1\n```\n\n## Installing the SDK\n### iOS\n\n1. Generating wrapper framework arround ff_ios_client_sdk library.\n\nOpen project `ff-ios-xamarin-client-sdk-binding/ff-ios-client-sdk-proxy/ff-ios-client-sdk-proxy.xcodeproj` in XCode.\n\nGo to `File-\u003ePackages-\u003eUpdate` to Latest Package Versions to pick the latest iOS client sdk. Observer version of ff-ios-client-sdk, and make sure it mathces with the latest on published to iOS Swift Package Manager.\n\nUpdate version of ff-ios-client-sdk-proxy by clicking on project file in XCode, selecting proper target and updating Version and Buid number from General tab. Suggestion is to keep this value in sync with value of iOS Xamarin binding published through nuget.\n\n\n\nTo build a library use build.sh script located in `ff-ios-xamarin-client-sdk-binding/ff-ios-client-sdk-proxy` folder. Before launching make sure that sharpie tool is installed from https://aka.ms/objective-sharpie\n\nAfter being launched, script will:\n* Build library for both simulator and device architecture, and create a fat library. Output build is located at ff-ios-xamarin-client-sdk-binding/ff-ios-client-sdk-proxy/build\n* Run sharpie tool, which generates .NET ApiDefinitions.cs file which is used in binding proces. In case if there is no changes in interface, ApiDefinitions.cs will stay the same. NOTE: After running sharpie, user need manuall to add base interface INativeObject to CxValue class.\n\u003cbr/\u003e\n\n2. Creating iOS Xamarin binding SDK\n\nOpen Solution file ff-xamarin-client-sdk-binding.sln and open Options of ff-ios-xamarin-client-sdk-binding project. In NuGet Package section, change Version and details related with nuget package.\n\nSelect Release configuration, then right clik on ff-ios-xamarin-client-sdk-binding project and select \"Create Nuget Package\". As a result nuget package will be generated at `ff-ios-xamarin-client-sdk-binding/bin/Release/ff-ios-xamarin-client-sdk.x.y.z.nupkg`, where x.y.z corresponds to version entered in NuGet Package section.\n\n\n3. Publishing package.\n\nPackage is published from command line by running\n\n__nuget push ff-ios-xamarin-client-sdk.x.y.z api_key  -Source https://api.nuget.org/v3/index.json__\n\nfrom location where nuget package is generated. api_key should be acquired on nuget platform.\n\n## Android\n\n1. Adding new Android library to binding project.\n\nGet proper Android FF SDK binary library (ff-android-client-sdk-1.0.9.aar), and copy to Jars folder. Delete older version.\n\nOpen solution file, and from project file in Jars folder, delete old .aar file, and using Add-\u003eNew File menu add new library. Select file and from properties menu make sure that build action \"LibraryProjectZip\" is selected.\n\n2. Creating Android Xamarin binding SDK\n\nOpen Solution file ff-xamarin-client-sdk-binding.sln and open Options of ff-android-xamarin-client-sdk-binding project. In NuGet Package section, change Version and details related with nuget package.\n\n\nSelect Release configuration, then right click on ff-android-xamarin-client-sdk-binding project and select \"Create Nuget Package\". As a result nuget package will be generated at `ff-android-xamarin-client-sdk-binding/bin/Release/ff-android-xamarin-client-sdk.x.y.z.nupkg`, where x.y.z corresponds to version entered in NuGet Package section.\n\n3. Publishing package.\n\nSame as iOS, package is published from command line by running\n\n__nuget push ff-android-xamarin-client-sdk.x.y.z api_key  -Source https://api.nuget.org/v3/index.json__\n\nfrom location where nuget package is generated. api_key should be acquired on nuget platform.\n\n## Code Sample\n\n### iOS library\n\nLibrary Initialization snippet\n\n```\n    // Create configuration:\n    var config = new CfConfigurationProxy\n    {\n        StreamEnabled = true,\n        AnalyticsEnabled = true\n    };\n\n    // Set selected identifer:\n    var target = new CfTargetProxy\n    {\n        Identifier = \"target_identifier\",\n        Name = \"target_name\"\n    };\n\n    // Initialize authentication. Update API_KEY with your key:\n    CfClientProxy.Shared.InitializeWithApiKey(API_KEY, config, target);\n```\n\nSubscribing on receiving library events:\n\n```\nusing System;\nusing ff_ios_client_sdk_proxy;\n\npublic class CfListener : CfClientDelegate\n{\n\n    public CfListener()\n    {\n        // Subscribe on getting events from native iOS library\n        CfClientProxy.Shared.Delegate = this;\n    }\n    // Received in case of error\n    public override void OnErrorWithError(CfErrorProxy error){}\n\n    // Contains array with flags received each pooling interval\n    public override void OnPollingEventReceivedWithEvaluations(CxEvaluation[] evaluations){}\n\n    // Event when flag value is changed\n    public override void OnStreamEventReceivedWithEvaluation(CxEvaluation evaluation){}\n\n    // Message received from library event\n    public override void OnMessageReceivedWithMessage(CxMessage message){}\n\n    // On Stream opened event\n    public override void OnStreamOpened() {}\n\n    // On Stream closed event\n    public override void OnStreamCompleted() {}\n}\n```\n\n### Android library\n\nLibrary Initialization snippet:\n\n```\n    CfConfiguration configuration = new CfConfiguration.Builder()\n        .EnableStream(true)\n        .EnableAnalytics(true)\n        .Build();\n\n    Target target = new Target()\n        .InvokeName(account)\n        .InvokeIdentifier(account);\n\n     // Initialize authentication. Update API_KEY with your key.\n     // Listener object should implement IAuthCallback interface:\n    CfClient.Instance.Initialize(this.context, API_KEY, configuration, target, listener);\n```\n\nSubscribing on receiving library events:\n\n```\nusing System;\nusing System.Linq;\nusing IO.Harness.Cfsdk.Cloud.Events;\nusing IO.Harness.Cfsdk.Cloud.Model;\nusing IO.Harness.Cfsdk.Cloud.Oksse;\nusing IO.Harness.Cfsdk.Cloud.Oksse.Model;\nusing Java.Interop;\nusing Java.Util;\nusing IO.Harness.Cfsdk;\n\npublic class CfListener : Java.Lang.Object, IAuthCallback, IEventsListener\n{\n\n    public CfListener()\n    {\n         // Subscribe on getting events from native Android library\n        CfClient.Instance.RegisterEventsListener(this);\n    }\n    public void AuthorizationSuccess(AuthInfo p0, AuthResult p1)\n    {\n        // p1.Success contains status of authorization\n        // In case of error p1.Error contains error message\n    }\n    public void OnEventReceived(StatusEvent p0)\n    {\n        var eventType = p0.EventType;\n        if(StatusEvent.EVENT_TYPE.SseStart == eventType)\n        {\n            // Stream started\n        }\n        else if( StatusEvent.EVENT_TYPE.SseEnd == eventType)\n        {\n            // Stream Ended\n        }\n        else if (StatusEvent.EVENT_TYPE.EvaluationChange == eventType)\n        {\n            Java.Lang.Object payload = p0.ExtractPayload();\n            var ev = payload as IO.Harness.Cfsdk.Cloud.Core.Model.Evaluation;\n            // Flag changed event\n        }\n        else if (StatusEvent.EVENT_TYPE.EvaluationReload == eventType)\n        {\n            Java.Lang.Object payload = p0.ExtractPayload();\n\n            var t = payload.JavaCast\u003cArrayList\u003e();\n            var arr = t.ToEnumerable\u003cIO.Harness.Cfsdk.Cloud.Core.Model.Evaluation\u003e().ToArray();\n\n            // Each pulling interval we will receive array of available flags.\n\n        }\n    }\n}\n```\n\n## Additional Reading\nFor further examples and config options, see the [Xamarin SDK Reference](https://docs.harness.io/article/x9mh0o785u-xamarin-sdk-reference).\n\nFor more information about Feature Flags, see our [Feature Flags documentation](https://docs.harness.io/article/7n9433hkc0-cf-feature-flag-overview).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-xamarin-client-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharness%2Fff-xamarin-client-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-xamarin-client-sdk/lists"}