ActivityRecording: Invalid Value

Former Member
Former Member
Hi

I am relatively new to Connect IQ SDK. I tried to create an ActivityRecording but it fails

Failed invoking <symbol>
Invalid Value
in timerStart (/Users/chris/Development/garmin/freeletics/source/Workout.mc:101)
in updateCountdown (/Users/chris/Development/garmin/freeletics/source/Workout.mc:127)
Error in timer callback


This is the code where it fails

session = Recording.createSession({:name => workoutName, :sport => Recording.SPORT_TRAINING, :subSport => Recording.SUB_SPORT_STRENGTH_TRAINING});
session.start();


Same error occurs when I use the RecordingSample from the examples.

I am running Eclipse on MacOSX.

Any ideas how to fix this?
  • Could you post the workout.mc source (at least the functions around what you see in the stack trace? )
  • If the code you're crashing in is accessing data from Activity.Info, are you checking for null values before you use it? See the api documention - things can be null, especially when recording first starts.
  • Failed invoking <symbol>
    Invalid Value
    in timerStart (/Users/chris/Development/garmin/freeletics/source/Workout.mc:101)
    in updateCountdown (/Users/chris/Development/garmin/freeletics/source/Workout.mc:127)
    Error in timer callback


    This is the code where it fails

    session = Recording.createSession({:name => workoutName, :sport => Recording.SPORT_TRAINING, :subSport => Recording.SUB_SPORT_STRENGTH_TRAINING});
    session.start();



    Is the createSession call on line 101? Have you verified that workoutName is less than 15 characters long? Have you tried other sport/subSport values? Do you get the same behavior?
  • Former Member
    Former Member over 8 years ago
    Is the createSession call on line 101? Have you verified that workoutName is less than 15 characters long? Have you tried other sport/subSport values? Do you get the same behavior?


    Yes createSession is on line 101.
    I tried to use a hardcoded workout name "test". Did not work either
    I tried default values which did not work. As an example I tried with

    session = Recording.createSession({:name => "test", :sport => Recording.SPORT_GENERIC, :subSport => Recording.SUB_SPORT_GENERIC});

    Exactly the same error happens in the RecordSample Example from the Garmin SDK. They use this line of code

    session = Record.createSession({:name=>"Walk", :sport=>Record.SPORT_WALKING});

    This is the whole method if that helps

    function timerStart() {
    if (countdown > 0 && countdownStarted == false) {
    Sys.println("start countdown timer");

    countdownStarted = true;
    updateCallback.invoke();

    countdownTimer.start(method(:updateCountdown), 1000, true);
    } else if(countdown == 0) {
    Sys.println("start workout timer");
    if(workoutTime == 0) {
    discard();
    session = Recording.createSession({:name => "test", :sport => Recording.SPORT_GENERIC, :subSport => Recording.SUB_SPORT_GENERIC});
    session.start();

    updateCallback.invoke();
    timer.start(method(:updateTimer), 1000, true);
    } else {
    timerStop();
    }
    }
    }


    This is the discard() method

    function discard() {
    if(session != null) {
    session.discard();
    }
    session = null;
    }



    I also tried using the newest Beta SDK but that did not help either.
  • I seem to recall that at one point at least, the RecordSample wasn't initializing the parent classes (there was a small warning icon in the Editor in Eclipse.). Adding it may help in figuring this one out.

    Make sure you have:

    for the app:

    class RecordSampleApp extends App.AppBase {

    function initialize() {
    AppBase.initialize();
    }



    for the delegate:

    class BaseInputDelegate extends Ui.BehaviorDelegate
    {
    function initialize() {
    BehaviorDelegate.initialize();

    }


    for the view:

    class RecordSampleView extends Ui.View {
    var timer;

    function initialize() {
    View.initialize();

    // other stuff
    }
  • Former Member
    Former Member over 8 years ago
    Everything is there. Also on my app.
  • Former Member
    Former Member over 8 years ago
    Hi

    Any help would be very appreciated. I also tried using the Beta SDK but that did not help either. Not sure what is going wrong here.
  • Unfortunately same problem here …

    Same message in same kind of line, both in my own source as well as RecordSample.

    Any help is greatly appreciated.

    Thank you!
  • &quot;Solved&quot;

    This appears to be a bug in 2.1.5 (I have not tried any other 2.1.x series SDKs).

    It works as advertised using 2.2.1.