Subscription preference

Notification emails are sent to your Samsung account email address.

* Email : anonymous@samsung.com

  

Close

Android Sleep Time

Forums View
Started by Newbie ansh**** , 140 Seed Apr 18, 2017 07:58 Replies : 23 View : 264568 Likes : 0
Here , I want to know thta why I'm getting issue while fetching sleep hours. The error is:

 java.lang.IllegalArgumentException - Not permitted property (com.samsung.health.sleep) is used

I'm trying same way as we got steps count by mentioning in manifest and activity and a reported class but I'm not getting sleep hours. The sleep count reporter class as:


Code

 
public class SleepCountReporter {

    private final HealthDataStore mStore;
    private final HealthResultHolder.ResultListener<HealthDataResolver.ReadResult> mListener = new HealthResultHolder.ResultListener<HealthDataResolver.ReadResult>() {
        @Override
        public void onResult(HealthDataResolver.ReadResult result) {
            int count = 0;
            Cursor c = null;

            try {
                c = result.getResultCursor();
                if (c != null) {
                    while (c.moveToNext()) {
                        count += c.getInt(c.getColumnIndex(HealthConstants.Sleep.HEALTH_DATA_TYPE));
                    }
                }
            } finally {
                if (c != null) {
                    c.close();
                }
            }
            MainActivity.getInstance().drawSleepCount(String.valueOf(count));
        }
    };
    private final HealthDataObserver mObserver = new HealthDataObserver(null) {

        // Update the sleep count when a change event is received
        @Override
        public void onChange(String dataTypeName) {
            Log.d(MainActivity.TAG, "Observer receives a data changed event");
            readTodaysleepCount();
        }
    };

    public SleepCountReporter(HealthDataStore store) {
        mStore = store;
    }

    public void start() {
        // Register an observer to listen changes of sleep count and get today sleep count
        HealthDataObserver.addObserver(mStore, HealthConstants.Sleep.HEALTH_DATA_TYPE, mObserver);
        readTodaysleepCount();
    }

    // Read the today's sleep count on demand
    private void readTodaysleepCount() {
        HealthDataResolver resolver = new HealthDataResolver(mStore, null);

        // Set time range from start time of today to the current time
        long startTime = getStartTimeOfToday();
        long endTime = System.currentTimeMillis();
        HealthDataResolver.Filter filter = HealthDataResolver.Filter.and(HealthDataResolver.Filter.greaterThanEquals(HealthConstants.Sleep.START_TIME, startTime),
                HealthDataResolver.Filter.lessThanEquals(HealthConstants.Sleep.START_TIME, endTime));

        HealthDataResolver.ReadRequest request = new HealthDataResolver.ReadRequest.Builder()
                .setDataType(HealthConstants.Sleep.HEALTH_DATA_TYPE)
                .setProperties(new String[]{HealthConstants.Sleep.HEALTH_DATA_TYPE})
                .setFilter(filter)
                .build();

        try {
            resolver.read(request).setResultListener(mListener);
        } catch (Exception e) {
            Log.e(MainActivity.TAG, e.getClass().getName() + " - " + e.getMessage());
            Log.e(MainActivity.TAG, "Getting sleep count fails.");
        }
    }

    private long getStartTimeOfToday() {
        Calendar today = Calendar.getInstance();

        today.set(Calendar.HOUR_OF_DAY, 0);
        today.set(Calendar.MINUTE, 0);
        today.set(Calendar.SECOND, 0);
        today.set(Calendar.MILLISECOND, 0);

        return today.getTimeInMillis();
    }

}


 Can anyone please look at it and help me to resolve the issue ?

Tags

AndroidSDK

Post Reply
Board View
Newbie roger.ka**** , 320 Seed Jan 13, 2018 13:44 Post #1 0
Typically, from what i've read about what seems to be your problem, this issue only happens on Samsung phones with android 7.0. Now, assuming you're dealing with an Android problem, you can try to see if this replicates on Android 7.1.2 available in Samsung's Developers Remote Test lab here http://developer.samsung.com/remotetestlab/rtlDeviceList.action# 
You may also want to see if this problem discussed on SO is pertinent to you https://stackoverflow.com/questions/30703845/exception-on-serialization-on-samsung-galaxy-s5
But you'd have to provide more context into your problem in order to get better feedback and help? Can you elaborate a bit?

Post Reply
Board View
Newbie hire1296 , 210 Seed Nov 04, 2018 12:01 Post #2 0
you can download gbwhatsapp from Droidapkhub.com  you can get BlackMart Alpha APK .
Post Reply
Board View
Newbie dexu8001 , 210 Seed Nov 05, 2018 23:18 Post #3 0
I think so , its happens only android 7.0 version mobiles only, so You can easily download Gbwhatsapp from techinfoworld.com , Like to wish the festival wishes with your smart name ? follow this link smart festival wishes
Post Reply
Board View
Newbie iq26475 , 210 Seed Nov 06, 2018 14:37 Post #4 0
Thanks, i used to work and https://wpplus2019.com/ web site work whatsapp plus latest version.
Post Reply
Board View
Newbie spraveen593 , 210 Seed Nov 08, 2018 01:08 Post #5 0
How to book tatkat ticket
Post Reply
Board View
Newbie Andrewkhinkle , 210 Seed Nov 08, 2018 19:54 Post #6 0


This content has been quoted from hire1296’s thought.

you can download gbwhatsapp from Droidapkhub.com  you can get BlackMart Alpha APK .

Yeah. I love them a Lot. 192.168.1.1 is the Default IP Address used as Gateway by Many WiFi Routers such as D-Link, NetGear, TP-Link, Linksys and Asus etc. Setup Wireless Network  using 192.168.1.1 and With 192.168.1.1, Administrator can Manage many General Settings of Router such as Wireless Settings, WPS, Guest Network, Security, Forwarding, IP & Mac Binding, Dynamic DNS, DHCP and many more with the help of 192.168.1.1 19216811.is
Post Reply
Board View
Newbie hakanl**** , 320 Seed Nov 13, 2018 07:26 Post #7 0
"Java.lang.IllegalArgumentException"
do you only get this error in sleep mode ? Can you share some more information? agario
Post Reply
Board View
Newbie anand.8**** , 850 Seed Nov 15, 2018 08:51 Post #8 0


This content has been quoted from hakanl****’s thought.

"Java.lang.IllegalArgumentException"
do you only get this error in sleep mode ? Can you share some more information? agario

https://samtechnology.org/gta-vice-city-free-download-setup/  

and Driver Booster download also check out Typing master


 

Post Reply
Board View
Newbie logi3966 , 210 Seed Nov 16, 2018 09:24 Post #9 0
Here is the all information about GBWhatsApp, like Is GBWhatsApp safe to use on not, and Who created GB WhatsApp and more. After reading this guide you will be able to take the right decision. 
Post Reply
Board View
Newbie maxd5145 , 210 Seed Nov 17, 2018 14:45 Post #10 0
You should try out gbwhatsapp in your android phone once. you can find many attractive games on my website.
Post Reply
Board View
Newbie BlogyMukesh , 210 Seed Nov 18, 2018 13:51 Post #11 0
hey there you can fix this issue via visiting Tricks Nation.
stylish boys fb names
thanks......

Code

 public void start() {
// Register an observer to listen changes of sleep count and get today sleep count
HealthDataObserver.addObserver(mStore, HealthConstants.Sleep.HEALTH_DATA_TYPE, mObserver);
readTodaysleepCount();
}

// Read the today's sleep count on demand
private void readTodaysleepCount() {
HealthDataResolver resolver = new HealthDataResolver(mStore, null);

// Set time range from start time of today to the current time
long startTime = getStartTimeOfToday();
long endTime = System.currentTimeMillis();
HealthDataResolver.Filter filter = HealthDataResolver.Filter.and(HealthDataResolver.Filter.greaterThanEquals(HealthConstants.Sleep.START_TIME, startTime),
HealthDataResolver.Filter.lessThanEquals(HealthConstants.Sleep.START_TIME, endTime));

HealthDataResolver.ReadRequest request = new HealthDataResolver.ReadRequest.Builder()
.setDataType(HealthConstants.Sleep.HEALTH_DATA_TYPE)
.setProperties(new String[]{HealthConstants.Sleep.HEALTH_DATA_TYPE})
.setFilter(filter)
.build();


Post Reply
Board View
Newbie sofie1248 , 210 Seed Nov 21, 2018 20:10 Post #12 0
Plz check this out once you will love it uporn and freepornvideos  you will get awesome videos here


Thanks 
Post Reply
Board View
Newbie androidboyzz , 210 Seed Nov 29, 2018 12:22 Post #13 0


This content has been quoted from maxd5145’s thought.

You should try out gbwhatsapp in your android phone once. you can find many attractive games on my website.


Also checkout this website to watch best and latest movies for completely free. https://moviehdapkdownloadz.com 

Post Reply
Board View
Newbie charliedarn , 210 Seed Dec 02, 2018 15:00 Post #14 0


This content has been quoted from sofie1248’s thought.

Plz check this out once you will love it uporn and freepornvideos  you will get awesome videos here


Tha
nks

www.theodysseyonline.com/free-application-to-stream-movies-tv-series 


Post Reply
Board View
Newbie thoitrangmanly , 210 Seed Dec 02, 2018 15:04 Post #15 0
This is very interesting thread. Thank for sharing. For sure your suggestions will help me with my website Shop thời trang cao cấp cho nam Manly. Make sure to check out our Ao khoac nam hang hieu products, they are hot sale right now!
Post Reply
Board View
Newbie anand.8**** , 850 Seed Dec 03, 2018 06:21 Post #16 0


This content has been quoted from thoitrangmanly’s thought.

This is very interesting thread. Thank for sharing. For sure your suggestions will help me with my website Shop thời trang cao cấp cho nam Manly. Make sure to check out our Ao khoac nam hang hieu products, they are hot sale right now!

if you are pubg lover then you must know about my website pubg for pc. Keep visiting for latest pubg updates.
Post Reply
Board View
Newbie abansod**** , 350 Seed Dec 04, 2018 09:46 Post #17 0
Thanks for sharing your opinion, i will follow this steps thnaks again,

but when ever i open thsi website there is osme error pops up on phone.
It happens only when i try to open this website.
Post Reply
Board View
Newbie joth5061 , 210 Seed Dec 04, 2018 12:30 Post #18 0
Be that as it may, continually considering new Instagram inscriptions can be hard. Particularly when you require a great deal Instagram inscription thoughts since you're continually postinginstagraminstagramcaptions.mobi

Post Reply
Board View
Newbie keer0505 , 210 Seed Dec 05, 2018 05:10 Post #19 0
On the off chance that you keep running into any inconvenience at all en route, don't be modest about reaching the specialized help group from HostGator.

hostgator coupon website
Post Reply
Board View
Newbie adam2810 , 210 Seed Dec 05, 2018 05:49 Post #20 0
So You can easily download Gbwhatsapp from techinfoworld.com , Like to wish the festival wishes with your smart name ? follow this link smart festival wishes

Follow The Link to Get Dp for WhatsApp
Post Reply
Board View
Newbie abansod**** , 350 Seed Dec 05, 2018 13:31 Post #21 0
Thanks for showing and  sharing different steps with various  website.

Thank you
Post Reply
Board View
Newbie jenn3499 , 210 Seed Dec 11, 2018 07:09 Post #22 0
Hi here all the informatin are good.

<a href="https://itubeapk.pro/">visititubeapk.pro</a>


Post Reply
Board View
Newbie meru1427 , 210 Seed Dec 11, 2018 12:14 Post #23 0
Grand Theft Auto series is a very popular game series familiar for Xbox and play store users. ... GTA 4 APK is an action-adventure game from Rockstar games. ... Grand Theft Auto: GTA 4 APK Download (Normal + MOD + OBB Data Files)


apkmoddy.com/gta-4-apk-download/





 


Post Reply