Document Center for Castar SDK
Documents Windows
Overview
Windows
Android
iOS
Android TV
Linux
CastarSdk for Windows Overview 2024-11-04 CastarSdk SDK will helps you make money with Windows apps. You only need to integrate once and reap the benefits easily.
It provides an integration package to support Windows applications developed using .NET(C#)/C++/C or other Windows development languages.
After 48 hours, you'll see revenue data in your dashboard. This document has a complete integrated solution and takes approximately 45 minutes to complete.
Integration options Supports:
Windows7-Windows11, 32 bits or 64 bits
Step 1:Apply for ClientId Go applications-> Add -> create your ClientId for Linux. Step 2:Download SDK for Windows windows.zip -> Unzipped files:
  • CastarSdk_64.dll
  • CastarSdk_386.dll
  • CastarSdkWin_64.dll
  • CastarSdkWin_386.dll
Step 3: SDK install (1) StartSDK is an interface function that opens SDK, and it receives a char* parameter, which is your own unique identifier Key. (2) StopSDK is a function that closes SDK interface functions without any parameters. It is executed when SDL is planned to be stopped. (3) Load the corresponding DLL file according to the production environment, and you can freely define the DLL path. (4) CastarSdkWin_ *. dll name can be changed, CastarSdk_ *. dll name cannot be changed.

        Example:Your CliendId is "CSK****FHQlUQZ"
            


        #include 
        #include 
        
        #ifdef  _WIN64
        #define SDKLOADFILEDLL L"CastarSdkWin_64.dll"
        #else
        #define SDKLOADFILEDLL L"CastarSdkWin_386.dll"
        #endif
        
        //Declare the function pointer to start running the SDK
        typedef BOOL(*endSdk)();
        
        //Declare function pointer to end running SDK
        typedef BOOL(*startSdk)(char* key);
        
        HMODULE hand = NULL;
        
        //Set the ClientId here
        const char *keybuf = "CSK****FHQlUQZ";
        
        void InitSDKStart() {
            startSdk demoDllStart = (startSdk)GetProcAddress(hand, "startSDK");
            if (demoDllStart)
            {
                /*
                The SDK will always block when running successfully, 
                and will throw a Boolean error when an exception occurs.
                */
                if (!demoDllStart((char *)keybuf))
                {
                    std::cout << "startSDK Error\n";
                }
            }
            else
            {
                std::cout << "startSDK Error\n";
            }
        }
        
        int main(int argc, char *argv[])
        {
            hand = LoadLibrary(SDKLOADFILEDLL);
            if (NULL == hand || INVALID_HANDLE_VALUE == hand) {
                std::cout << "LoadLibrary Error\n";
                return -1;
            }
        
            //The thread calls the InitSDKStart function to avoid blocking the main thread.
            CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)InitSDKStart, NULL, 0, NULL);
        
            /*
            ......
            Handle your own business logic here
            */
        
            //When needed, call the end function
            endSdk demoDllEnd = (endSdk)GetProcAddress(hand, "stopSDK");
            if (demoDllEnd)
            {
                demoDllEnd();
            }
            else
            {
                std::cout << "startSDK Error\n";
            }
        
            std::cout << "End SDK Demo!\n";
        }
            
Attention: 1.The suffixes _64 and _386 correspond to 64 bit and 32-bit compilation environments, respectively. Please load the DLL appropriately according to the program compilation environment.
2.The startSDK function blocks execution. Please open a sub thread for execution, otherwise it will block the main thread.
1.CastarSdkWin_ *. dll depends on CastarSdk_ *. dll. When deploying in a production environment, please place both DLLs in a directory that the program can load.
CastarSdk for Android Overview 2024-11-04 CastarSdk SDK for Android helps you make money with Android apps. You only need to integrate once and reap the benefits easily.
It provides an integration package to support Android applications developed using Java/Kotlin. After 48 hours, you'll see revenue data in your dashboard. This document has a complete integrated solution and takes approximately 45 minutes to complete.
Integration options Supports:
ARMv7 and ARMv8 architectures;
Android system 4.3+
Step 1:Apply for ClientId Go applications-> Add -> create your ClientId for Android Step 2:Download SDK for Android Step 3:Import SDK Lib (1).Add the CastarSdk.aar file to your project,put it into App module's libs directory. (2).Implementation sdk in your app module's build.gradle file.
                
    dependencies {
        implementation(files("libs/CastarSdk.aar"))
    }
                
            
(3).Add internet permission in your app module's AndroidManifest.xml file.
                
    <uses-permission android:name="android.permission.INTERNET" />
                
            
(4).Create your Application, init sdk and start it.

        Example: Your CliendId is "CSK****FHQlUQZ"
            

    import android.app.Application
    import com.castarsdk.android.CastarSdk
        
    class MyApplication:Application() {

                override fun onCreate() {
                    super.onCreate()
                
                    //set your ClientId and start sdk.
                    CastarSdk.Start(this,"CSK****FHQlUQZ")
                }
                
            }
            
(5).Declare your application in your AndroidManifest.xml file.
   
    <application
        android:icon="@mipmap/ic_launcher"
        android:label="demo"
        android:name=".MyApplication"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Test2"
        tools:targetApi="31"<

    </application<
            
Optional APIs Start service CastarSdk.start() Stop service CastarSdk.Stop()
CastarSdk for IOS Overview 2024-11-04 CastarSdk SDK for IOS helps you make money with Android apps. You only need to integrate once and reap the benefits easily.
It provides an integration package to support Android applications developed using Objective-C/Swift. After 48 hours, you'll see revenue data in your dashboard.
This document has a complete integrated solution and takes approximately 45 minutes to complete.
Integration options Supports:
iOS 12.0+, Xcode15.3+
Step 1:Apply for ClientId Go applications->Add ,create your ClientId for IOS Step 2:Download SDK for iOS Step 3:Install the SDK Copy the unzipped ClientSDK.xcframework and SunClientSDK.xcframework files to the project folder Step 4:Set up the SDK Select the TARGETS > Project Name > General > Frameworks, Libraries, and Embedded Content menus, add the ClientSDK.xcframework file, and set the Embed property to Embed & Sign to keep the SDK dynamic library consistent with the application signature. At this point, the SDK import is complete (1) Reference the SunClientSDK.xcframework,SunClientSDK.xcframework file to the project. (2) Ensure that the Embed option of ClientSDK.xcframework in Frameworks, Libraries, and Embedded Content is set to Embed&Sign. (3) Add the header file "import ClientSDK" to the referenced files. (4) Set the ClientId and start the SDK.
                
                 Example: Your CliendId is "CSK****FHQlUQZ"
            
            
                
    import UIKit
    import SunClientSDK

    class ViewController: UIViewController {

        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view.

            // Set ClientId
            let key = "CSK****FHQlUQZ"
    
            /// Initialize SDK and set key
            ClientSDKTool.initSDK(key: key)
            
            // start sdk
            ClientSDKTool.start()
            
            // stop sdk
            // ClientSDKTool.stop()
            
        }

    }
                
            
Step 5:SDK API (1) Start the SDK
                
                    // Start the SDK
                    ClientSDKTool.start()
                
            
(2) Stop the SDK when you need to do.
                
                    // Stop the SDK
                    ClientSDKTool.stop()
                
            
CastarSdk for Android TV Overview 2024-11-04 CastarSdk SDK for Android helps you make money with Android apps. You only need to integrate once and reap the benefits easily.
It provides an integration package to support Android applications developed using Java/Kotlin. After 48 hours, you'll see revenue data in your dashboard. This document has a complete integrated solution and takes approximately 45 minutes to complete.
Integration options Supports:
ARMv7 and ARMv8 architectures;
Android system 4.3+
Step 1:Apply for ClientId Go applications-> Add -> create your ClientId for Android Step 2:Download SDK for Android Step 3:Import SDK Lib (1).Add the CastarSdk.aar file to your project,put it into App module's libs directory. (2).Implementation sdk in your app module's build.gradle file.
                
    dependencies {
        implementation(files("libs/CastarSdk.aar"))
    }
                
            
(3).Add internet permission in your app module's AndroidManifest.xml file.
                
    <uses-permission android:name="android.permission.INTERNET" />
                
            
(4).Create your Application and init sdk

        Example:Your CliendId is "CSK****FHQlUQZ"
            

    import android.app.Application
    import com.castarsdk.android.CastarSdk
        
    class MyApplication:Application() {

                override fun onCreate() {
                    super.onCreate()
                
                    //set your ClientId and start sdk.
                    CastarSdk.Start(this,"CSK****FHQlUQZ")
                }
                
            }
            
(5).Declare your application in your AndroidManifest.xml file.
   
    <application
        android:icon="@mipmap/ic_launcher"
        android:label="demo"
        android:name=".MyApplication"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Test2"
        tools:targetApi="31"<

    </application<
            
Optional APIs Start service CastarSdk.start() Stop service CastarSdk.Stop()
CastarSdk for Linux Overview 2024-11-04 CastarSdk SDK will helps you make money with Linux apps. You only need to integrate once and reap the benefits easily.
After 48 hours, you'll see revenue data in your dashboard. This document has a complete integrated solution and takes approximately 45 minutes to complete.
Integration options Step 1:Apply for ClientId Go applications-> Add -> create your ClientId for Linux. Step 2:Download SDK for Linux Step 3: SDK install (1) Extract the file to obtain the binary executable program, as follows.
                
CPU architectures:  Executable program
linux/386 :         CastarSdk_386
linux/amd64 :        CastarSdk_amd64
linux/arm  :         CastarSdk_arm
                
            
(2) Grant the program executable permissions, for example.
                
chmod +x client_386
or
chmod +x client_amd64
or
chmod +x client_arm
                
            
(3) Launch the program

Example:Your CliendId is "CSK****FHQlUQZ"
                


./client_386   -key=CSK****FHQlUQZ
or
./client_arm   -key=CSK****FHQlUQZ
or
./client_amd64 -key=CSK****FHQlUQZ
            
this is a toast