You can download and integrate the CPIK libraries files for Android Xamarin one of two ways:
- Automated method, using our public repository.
- Manual method, by logging into our public repository or Partner Portal..
Open your solution in Visual Studio and then select Tools > Options. Scroll down to NuGet Package Manager, expand it, and then select Package Sources. Click on the plus icon to add a new source.
In the Name field, enter a name (ex: trimble-maps) and in the Source field, enter this url:
https://trimblemaps.jfrog.io/artifactory/api/nuget/xamarin. Make sure the checkbox is checked and hit OK.
Go to Tools > NuGet Package Manager > Manage NuGet Packages For Solution. Now select the name you chose in Step 2 in the Package source dropdown box. After about a minute, on the left side of the pane, you should see one package appear named cpik. If it is not installed, select it and hit Install. If it is already installed, check if any new update is available in the update section. Once the install is complete, you should see CPIKWrapper has been added under your project References.
You can manually download the files:
- As NuGet packages in our public repository:
- As a .zip file in our Partner Portal:
https://c2.trimblemaps.com/. After downloading and extracting the CoPilot CPIK libraries .zip file from the partner portal, you should have access to everything needed to get up and running quickly. The CPIK libraries package includes the following:
- Source code of the sample application
- Sample application APK that can be install on Android device
Libraries & Resources
- Libs/CPIKWrapper.dll : Customer application shall use this library to integrate CPIK libraries
- Native Libs/. : Native library need to place at libs folder in customer application
- Asset: Need to copy to customer’s application asset folder
- AndroidManifest_template.xml: Reference AndroidManifest.xml file.
Note: When downloading files, be sure to download the latest version of CoPilot and to only include files from that version in your project.
The Xamarin interface is available for the Android platform. This interface results in all Android compatible APIs being supported within Xamarin Android. It has not been noted on individual APIs that they are also compatible on Xamarin via this interface as it is always true unless stated otherwise.
Open the SampleApp.sln from Sample App/Source Code/SampleApp.sln to Xamarin Studio
It contains all the information required to run i.e library, asset, resources, component etc.
You can run
- Sample APK which can be installed on CoPilot
This is binding library to interface with CoPilot. All the CPIK libraries jar files are wrap into CPIKWrapper.dll by using the Xamarin Binding Library project. Developer need to add reference to this library into their application.
This is the native library use by the CoPilot. Copy the native library to your project. Copy all the folders under “Library and Resource/native libs/.” to “
/lib/.” to your project. It contains native library for different architecture which is required to run CoPilot. If you have existing lib folder to your project, merge the content. To deploy a native library with a Xamarin.Android application, add the library binary to the project and set its Build Action to AndroidNativeLibrary.
Copy “Library and Resource/assets” folder into your project. Copy entire assets folder located under “Library and Resource/assets/” to “
/assets/” folder to your project. It contains vital information to run the CoPilot e.g theme, config files, skin etc. If you have existing assets folder to your project, merge the content. Make sure that entire Copilot folder under Assets are added to Xamarin and set BuildAction to AndroidAsset.
This file contains all required attribute and permission to run the CoPilot. Developer need to merge this information to their existing AndroidManifest.xml.
Integrate the contents of “Library & Resource/AndroidManifest_template.xml” into your application’s AndroidManifest.xml.
Extract the “Library & Resource/assets” folder from the library package into your project (usually “
/assets/). Make sure that entire Copilot folder under Assets are added to Xamarin and set BuildAction to AndroidAsset.
Reference “Library & Resource/libs/ CPIKWrapper.dll” to your project to access all the classes/members of the CPIK libraries library and set BuildAction to AndroidNativeLibrary.
Copy “Library & Resource/Native libs/.” folder to your project’s lib folder (usually “
/lib/.**”). It contains native library for all different architecture.
Develop! Use the included sample application as a guide.
The API documentation detailed on this site references the classes and its members. It also contains the signature of the each member of the classes including description and usage.
The documentation contains syntax for Java. Developers can easily map the relevant syntax with C# in Xamarin. You can also check the syntax in Xamarin by exploring CPIKWrapper.dll by adding reference in project.
This sample application is meant to demonstrate how to properly integrate CoPilot into your application. If you’re just getting started, take a look at MainActivity.cs. This is the application’s launcher activity. It demonstrates how to bind to the CoPilot service and how to show the service’s associated view either through a fragment (see CustomFragment.cs) or by simply putting the view on the screen. After binding to the service, you will receive a callback (onCPStartup()) from CoPilot that indicates that the library is ready to receive API calls.
Most of our APIs are demonstrated in the sample app via various fragment classes that each correspond to a different API module. These fragments are controlled by ApiMainActivity.cs. If you have a question about how to use a specific API, look at the module’s fragment to see how to use it properly.
It has been noted that in some circumstances the CoPilot UI can appear significantly darker/dimmer than the integrated application. This can be due to the
styles.xml settings and easily resolved by adding the following to your styles.xml:
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:backgroundDimEnabled">false</item> </style>