×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    39

    Device charging using power plug and USB

    Hi,,

    I am working on windows phone c# application. I am using Microsoft.Phone.Info.DeviceStatus.PowerSource class and "External" keyword to check whether the device is connected to external power supply. But how can we know whether the device is connected to a battery charger (using power plug )or to the USB cable. I am using Battery class to get the remaining battery percentage in windows phone 8. But I couldn't find any API's for getting battery percentage in windows phone 7. Could you please help me to find a solution to my problem.

    thanks in advance,
    Aswathy.

  2. #2
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India
    Posts
    138

    Re: Device charging using power plug and USB

    Hi,

    For your requirement you can use the Battery class to know Battery status by using the its Events, Method and Property.

    However Windows Phone 7 SDK does not support this API.

    Hope it helps.
    Last edited by pavan.pareta; 2013-08-20 at 07:33.
    Pavan Pareta
    Sr. Software Engineer
    http://windows-mobile-dev.blogspot.com

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    39

    Re: Device charging using power plug and USB

    hi ,,
    Thanks for your reply. Using the Battery class I could find the RemainingChargePercent of battery in windows phone 8 only. WP7 doesn't support that API. Also I want to catch the different events ie: the event while the device is connected to the power plug as well as the event when connected to the USB cable. I would like to know how to identify these events. Hope u understand my problem. Waiting for your reply.

    thanks,
    Aswathy.

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    518

    Re: Device charging using power plug and USB

    There are no APIs that enable this on WP7 at all.

    There are no Events you can use in your Apps that would allow you to detect device status changes. If your App is running you could poll the property to get that information but it is not possible to e.g. launch an App when the device is connected to an external power source or anything like that.

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    568

    Re: Device charging using power plug and USB

    You can only detect if the phone is a) connected to a power supply or b) running on battery. The DeviceStatus API doesn't give anymore info than that.

  6. #6
    Registered User
    Join Date
    Jul 2013
    Posts
    39

    Re: Device charging using power plug and USB

    Hi all,,

    Thanks for giving me reply. I would like to know whether there is any c++ library available , so that we can do a workaround for it. Once again thanks for showing interest in this query.

    Aswathy.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    957

    Re: Device charging using power plug and USB

    Quote Originally Posted by AbhinavPajnoo View Post
    Hi all,,

    Thanks for giving me reply. I would like to know whether there is any c++ library available , so that we can do a workaround for it. Once again thanks for showing interest in this query.

    Aswathy.
    Sorry, no workaround so far for this. It would be nice to get a notification of sorts from the OS to our apps and its been a recurring request but for now we are stuck until Microsoft devices to open up the API to allow that.

Similar Threads

  1. Power Key press when device is locked
    By jawadakhtar in forum Symbian
    Replies: 4
    Last Post: 2011-11-16, 11:28
  2. auto power on when charging
    By rishiak in forum Symbian
    Replies: 5
    Last Post: 2007-12-27, 17:48
  3. How to set the WLAN device power on and off
    By xhsoldier in forum Symbian
    Replies: 0
    Last Post: 2006-10-27, 05:32
  4. Autostart happen when charging the off-device
    By allyfeng in forum Symbian
    Replies: 2
    Last Post: 2005-01-17, 10:27
  5. solar power charging of 8890 battery
    By wthurtell in forum General Development Questions
    Replies: 0
    Last Post: 2004-01-29, 10:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×