Linea Pro Charging ipod/iphone

The Linea Pro SDK allows our applications to monitor the battery of the connected iOS device and
charge when appropriate. When the Linea Pro Charging is set to TRUE, we need to use these settings in the application to monitor and switch on / off settings.
So, What is the required flag or method to set to TRUE in Linea Pro SDK to enable charging ipod/ iphone. Can anyone suggest me the answer.
Thanks in Advance.

Answers

  • The link provided you in swift language but I am using Xamarin which uses C# language. Can you please suggest me in C#.

  • ArvindrajaArvindraja INMember ✭✭✭

    @lavanya.4857
    I posted that link, I thought you may get idea from that. I am not familiar with Linea P SDK's.
    Have a look on below link might it help you in charging related stuff
    https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/battery-info/

  • Yes I got idea from the link which you sent but I am not getting how to convert swift to C#. I strucked in conversion part. And also I tried the link which you sent for getting the battery info, I am successfully getting the battery info but based on that battery info i need to charge ipod/iphone using Linea Pro Scanner.

  • AlexanderPAlexanderP USMember ✭✭

    @lavanya.4857 said:
    Yes I got idea from the link which you sent but I am not getting how to convert swift to C#. I strucked in conversion part. And also I tried the link which you sent for getting the battery info, I am successfully getting the battery info but based on that battery info i need to charge ipod/iphone using Linea Pro Scanner.

    Can you provide a sample of your code, specifically how you initialise the Linea object?
    But, basically, there should be a method called "SetCharging(bool enabled, out NSError error)". You will need to invoke that method.
    Keep in mind, Linea battery is not that big - it will drain quickly if you charge iDevice with it.

  • mischelmischel DEMember ✭✭

    try follow code:
    private Linea scanner;
    private void InitScanner()
    {
    scanner = Linea.SharedDevice;
    LineaDispatcher disp = new LineaDispatcher();
    disp.ConnectionStateChanged += Disp_ConnectionStateChanged;
    scanner.AddDelegate(disp);
    scanner.Connect();

        }
        private void SetCharging()
        {
            if (!UIDevice.CurrentDevice.BatteryMonitoringEnabled)
                UIDevice.CurrentDevice.BatteryMonitoringEnabled = true;
            NSError error;
            bool isCharging = false;
            scanner.GetCharging(out isCharging, out error);
            if (!isCharging)
                scanner.SetCharging(true, out error);
    
        }
    
        private void Disp_ConnectionStateChanged(LineaDelegate Dispatcher, ConnectionStateChangedEventArgs Arguments)
        {
            switch (Arguments.State)
            {
                case ConnStates.Disconnected:
                    break;
                case ConnStates.Connecting:
                    break;
                case ConnStates.Connected:
                    SetCharging();
                        break;
                default:
                    break;
            }
        }
    

    And you must know. Linea wiil be not charging if own akku <50%

Sign In or Register to comment.