Pre loader

Trial License Key not working?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

I’m not sure what is going on, but I am consistently getting an error about my trial license key not being valid (it has 28 days left)

Error msg: “Sorry! You have not set a License Key. You can request a free trial key from http://www.scichart.com...”

Code (trial key partially snipped):

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    // Set this code once in MainActivity or application startup
    SciChartSurface.setRuntimeLicenseKey("w2q0iyS8UeR2HKF...uqUbxqjprSIvXJPibCSl1g6ag==")

    // Get the scichartsurface
    val surface = findViewById<com.scichart.charting.visuals.SciChartSurface>(R.id.id_scichartsurface)
    // Initialize the SciChartBuilder
    SciChartBuilder.init(this)
    // Obtain the SciChartBuilder instance
    val sciChartBuilder = SciChartBuilder.instance()
    // Create a numeric X axis
    val xAxis: IAxis = sciChartBuilder.newNumericAxis()
        .withAxisTitle("X Axis Title")
        .withVisibleRange(-5.0, 15.0)
        .build()
    // Create a numeric Y axis
    val yAxis: IAxis = sciChartBuilder.newNumericAxis()
        .withAxisTitle("Y Axis Title").withVisibleRange(0.0, 100.0).build()
    // Create a TextAnnotation and specify the inscription and position for it
    val textAnnotation = sciChartBuilder.newTextAnnotation()
        .withX1(5.0)
        .withY1(55.0)
        .withText("Hello World!")
        .withHorizontalAnchorPoint(HorizontalAnchorPoint.Center)
        .withVerticalAnchorPoint(VerticalAnchorPoint.Center)
        .withFontStyle(20f, ColorUtil.White)
        .build()
    // Create interactivity modifiers
    val chartModifiers = sciChartBuilder.newModifierGroup()
        .withPinchZoomModifier().withReceiveHandledEvents(true).build()
        .withZoomPanModifier().withReceiveHandledEvents(true).build()
        .build()
    // Add the Y axis to the YAxes collection of the surface
    Collections.addAll(surface.yAxes, yAxis)
    // Add the X axis to the XAxes collection of the surface
    Collections.addAll(surface.xAxes, xAxis)
    // Add the annotation to the Annotations collection of the surface
    Collections.addAll(surface.annotations, textAnnotation)
    // Add the interactions to the ChartModifiers collection of the surface
    Collections.addAll(surface.chartModifiers, chartModifiers)
}

Any assistance appreciated. Thank you.

Version
3.0.0.4253
Images
  • You must to post comments
Best Answer
0
0

Hi there,

You need to set license before any SciChart related stuff is used. That’s why in this article we create custom Application class. In your case I belive SciChartSurface is defined in XML layout which is inflated durin setContentView() call. This means that chart is created before license is set. Please try to move setRuntimeLicenseKey() before that call:

// Set this code once in MainActivity or application startup
SciChartSurface.setRuntimeLicenseKey("w2q0iyS8UeR2HKF...uqUbxqjprSIvXJPibCSl1g6ag==") 

setContentView(R.layout.activity_main)

Hope this will help you!

Best regards,
Yura

  • You must to post comments
0
0

Thank you.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies