How to Get the Time spent on an application in Android Programmatically - General Questions and Answers

I want to get the Usage time of all those applications which i have used today. As i am getting the those details by dialing *#*#4636#*#*.
But i want these details programmatically in a android.
please help me out in this.
we can see how these play store apps are able to show the usage Statistics
Break Free
App Usage

himanshu111 said:
I want to get the Usage time of all those applications which i have used today. As i am getting the those details by dialing *#*#4636#*#*.
But i want these details programmatically in a android.
please help me out in this.
we can see how these play store apps are able to show the usage Statistics
Break Free
App Usage
Click to expand...
Click to collapse
Hey there,
If using API 21 or higher, you can use the UsageStatsManager, which can tell you how much time each app has spent in the foreground.

what about the older API's ?
kolejnik said:
Hey there,
If using API 21 or higher, you can use the UsageStatsManager, which can tell you how much time each app has spent in the foreground.
Click to expand...
Click to collapse
what if someone is using phone which is lesser than lolipop , there we will get these stats or not?

himanshu111 said:
what if someone is using phone which is lesser than lolipop , there we will get these stats or not?
Click to expand...
Click to collapse
No, you won't be able to see the stats.
For older APIs you could use getRunningTasks in ActivityManager, but it's not nearly as nice. You would basically have to compute the usage stats yourself. The first app in the list returned by this method should be the app currently in the foreground. So you could call this method fairly frequently and measure how much time each app spends in the foreground.

thanks a lot Kolejnik for guiding me.
kolejnik said:
No, you won't be able to see the stats.
For older APIs you could use getRunningTasks in ActivityManager, but it's not nearly as nice. You would basically have to compute the usage stats yourself. The first app in the list returned by this method should be the app currently in the foreground. So you could call this method fairly frequently and measure how much time each app spends in the foreground.
Click to expand...
Click to collapse
thanks for helping me out .

himanshu111 said:
thanks for helping me out .
Click to expand...
Click to collapse
No problem! Good luck

Related

Monitor data usage per app

Anyone know of an app that will monitor data usage on an app by app basis? I know there are heaps that will monitor total data use, but I'm looking for something to show the data used by apps individually.
-------------------------------------
Sent from my HTC Magic
Subscribed
SpareParts
I use 3g watchdog. it has a widget with it and can stay in your notification bar
Have you found the tool?
I also search a tool that can show what app used how much data.
Actually, i have something eating a lot of data, and even uploads a lot and i don't know what it is (40 to 50 MB per day are used on my data plan only because of that).
I don't want to necro a thread, but just in case people are interested in the answer:
I found 2 apps on the market that can do this. TrafficInfo and TrafficStats.
JasonX-NL said:
I don't want to necro a thread, but just in case people are interested in the answer:
I found 2 apps on the market that can do this. TrafficInfo and TrafficStats.
Click to expand...
Click to collapse
those dont measurfe per app...i founf the latest version of 3G Watchdog which measure PER APP but only from 2.2firmware and upwards...damn cant wait for GB
Some thing is eating my data and i dont know what it is
Im logged out of all social networking even gmail and Gtalk, but something still eats up to 30MB per day, by the time i wake up in the morning almost 10MB alrady used up.
You should give My Data Manager Free a shot. It keeps track of mobile,wifi and roaming separately. It shows data usage per app and displays usage by bar graph or pie chart.
jr67 said:
You should give My Data Manager Free a shot. It keeps track of mobile,wifi and roaming separately. It shows data usage per app and displays usage by bar graph or pie chart.
Click to expand...
Click to collapse
if u say it shows data usage per app then ill try it...hope it will work on my 2.1...thanx
jr67 said:
You should give My Data Manager Free a shot. It keeps track of mobile,wifi and roaming separately. It shows data usage per app and displays usage by bar graph or pie chart.
Click to expand...
Click to collapse
i wont install on my 2.1, r u using 2.1?
digitaljeff said:
Anyone know of an app that will monitor data usage on an app by app basis? I know there are heaps that will monitor total data use, but I'm looking for something to show the data used by apps individually.
-------------------------------------
Sent from my HTC Magic
Click to expand...
Click to collapse
there are a few but u have to be on 2.2 or higher first...cnt wait for X10 to get GB
Sorry for the bad recommendation. I don't think there is anything that will do what you need on 2.1. Why are waiting for gb why don't you update to froyo in the meantime?
jr67 said:
Sorry for the bad recommendation. I don't think there is anything that will do what you need on 2.1. Why are waiting for gb why don't you update to froyo in the meantime?
Click to expand...
Click to collapse
Cool no probs,
Im trying to find the easiest way of doing it...i have tried to install CM7 and i bricked my X10, have u got a link for me that has the easiest way of installing it froyo? how is the battery usage on froyo...i read reports that its bad.

[APP]Network Spoofer *trick your friends*

Network Spoofer lets you mess with the internet on other people's computers.
Network Spoofer lets you mess with websites on other people's computers:
1)flip pictures
2)change Google searches
3)redirect websites
4)swap YouTube videos and many more features to come.
REQUIREMENTS:
* Root (superuser)
* Wifi
* 500MB SD card space
KNOWN INCOMPATIBILITIES:
* Droid X (solution being worked on)
How it works?
APP LINK: chuck norris power
Developer website: http://digitalsquid.co.uk/
DISCLAIMER: The developer(s) of this application are not in any way responsible for it's use or misuse; only use it for demonstration purposes on networks for which you have permission to do so.
Added latest version 0.9.0 So far you can download it from google play, but if google will remove it, you can download uploaded apk
2012.06.14 SEEMS THAT GOOGLE REMOVED FROM PLAY STORE.
TESTED ON GALAXY NOTE, GALAXY S3 AND IT IS WORKING.
Downloading and trying with SGS2.
atm faced up with this issue "a MAJOR CPU hog AFTER it has been closed. I understand it using a large amount of CPU during its activity.. but after i exit it continues to keep CPU at 100% until i reboot... "" but if you want to use this app and dont want to have this issue- you will need to make reboots after you have used that app.
If you download it might me cool to mirror the APK. I predict this is removed within 2 days by Google
sdk16420 said:
If you download it might me cool to mirror the APK. I predict this is removed within 2 days by Google
Click to expand...
Click to collapse
yeh ok no problem i think also, google will remove it
Looks interesting, gonna give it a try. But why does it require so much SD space?
It doesn't work for me. And I also had the huge cpu usage after closing the app until I restarted the phone.
I have a suggestion. You know how the WifiKiller app is able to detect the card manufacturer? For e.g. "Apple Computer" would show up with the ipaddress? Is it possible to implement something like this
ArmorD said:
Looks interesting, gonna give it a try. But why does it require so much SD space?
Click to expand...
Click to collapse
im not developer but i think for trolo pictures, trolo video and etc.
binlalo said:
It doesn't work for me. And I also had the huge cpu usage after closing the app until I restarted the phone.
Click to expand...
Click to collapse
hmmm it is only for ics and not for all phones it is working
It has been around for months in the market, I doubt it is gonna get pulled now.
ArmorD said:
Looks interesting, gonna give it a try. But why does it require so much SD space?
Click to expand...
Click to collapse
Debian Iso is needed.
DnaPolymerase said:
Debian Iso is needed.
Click to expand...
Click to collapse
Lol XD. I hope it wont be pulled.
Sent from my GT-I9100 using XDA Premium HD app
Thanks.. Am gonna try it with my SII
Ohh ok, then that's the problem, I'm on gingerbread. For any other I9001 user, don't bother, it doesn't work.
why is that much space is neeede on sdcard?
Bilgets said:
why is that much space is neeede on sdcard?
Click to expand...
Click to collapse
This app seems nice but I second that!
hmm guys....any other ways of stopping it from using max CPU after you close the app besides restarting the phone.
tried force closing the app but my cpu still stays at max.
Bilgets said:
why is that much space is neeede on sdcard?
Click to expand...
Click to collapse
This runs a debian image background. It uses it to do the actions.
Sent from my GT-I9100 using XDA Premium HD app
Sir,
You are creating a real evil software.
Congratulations for that!!
OP: I'm a network administrator and someone showed me this and I don't understand how it works.. how do I prevent people from doing this sort of thing on my network? Pretty sure this is on the same lines as WifiKill if I'm correct? The device use arp and pretends to be the router?

[Q] how to force auto-update specific apps @ predefined timings?

as above - for example, some apps only allow auto-update every 12 hours. what i want to achieve is - to have all my news feeds/emails/evernote synced and updated before I leave house in the morning (so we can tap on the WIFI instead of 4G). is there an app I could use to achieve that?
Thanks!
dylansmith said:
as above - for example, some apps only allow auto-update every 12 hours. what i want to achieve is - to have all my news feeds/emails/evernote synced and updated before I leave house in the morning (so we can tap on the WIFI instead of 4G). is there an app I could use to achieve that?
Thanks!
Click to expand...
Click to collapse
Simplify your Question Bro..
jime1 said:
Simplify your Question Bro..
Click to expand...
Click to collapse
Example:
Pulse App
App only allows 12 hourly auto-update over WIFI
what I need : auto-update at fixed timings - e.g. every 7am and 10pm.
what i need #2 : do this for every app (e.g. Evernote/feedly/Gcal/facebook/flipboard)
dylansmith said:
Example:
Pulse App
App only allows 12 hourly auto-update over WIFI
what I need : auto-update at fixed timings - e.g. every 7am and 10pm.
what i need #2 : do this for every app (e.g. Evernote/feedly/Gcal/facebook/flipboard)
Click to expand...
Click to collapse
great idea bro..i don't know about such app but if you know android development then you should definitely create one by Yourself:good::highfive:
jime1 said:
great idea bro..i don't know about such app but if you know android development then you should definitely create one by Yourself:good::highfive:
Click to expand...
Click to collapse
i have 0 coding knowledge and was just wondering if someone already thought of the same thing and have an app ready for it..
dylansmith said:
i have 0 coding knowledge and was just wondering if someone already thought of the same thing and have an app ready for it..
Click to expand...
Click to collapse
your desire is very specific so difficult to find.. but you can find it on google if you keep trying:good:
jime1 said:
your desire is very specific so difficult to find.. but you can find it on google if you keep trying:good:
Click to expand...
Click to collapse
already did, would appreciate if anyone found anything similar..
thanks!

[APP] [BETA] Phone Usage Monitor

Hello,
I want present my new app. that is in beta stage but fully functional: Phone usage monitor.
With this app you will be able to know when and how much you use your device and the apps that you have in it.
Please, report issues, if any, and suggest more events to monitorize.
Thanks
Play Store Description
Are you obsessed with your phone?
Up to what point?
Do you want to be aware of which apps are the most used?
Do you want to know what WiFi networks you connect to and at what time?
When are your applications updated?
Do you want to know if your phone suffers a expontaneous reboot or when you turn on or off the screen?
You need this app and you know it!
Play store link
https://play.google.com/store/apps/details?id=com.ryosoftware.phoneusagemonitor
Looking good! An option to exclude certain apps like Nova Launcher would be nice.
WDawn said:
Looking good! An option to exclude certain apps like Nova Launcher would be nice.
Click to expand...
Click to collapse
Thanks for the suggestion. Great idea!
It would also be nice to be able to monitor a remote phone (opening up the app to for parental monitoring for example).
This could be achieved by either allowing to :
- send a daily report by mail
- having a client app with data synced whenever a connection is avaialable
- sending data to a central server
...
anyway to export the data as .csv ?
Hello, thanks for app!
Any chance to remove "full network access" from permissions in future ?
Heya! Congrats on making the portal. Good stuff you got there.
Here's some suggestions for the intro texts:
Part 1 - Current
"Do you want to know how do you use your smartphone?
You have installed this app, so the answer will surely be affirmative.
With this app you can know with what apps you lose your time; time which you could lose living your real life..."
Part 1 - Suggested
"Would you like to know how you use your smartphone?
Well, as you've already installed this app, that'll be an affirmative!
By gathering statistics about your apps with Phone Usage Monitor, you'll know where your precious time is creeping off to. Time you might want to spend on living your real life..."
Part 1 - Motivation
The second "do" doesn't really have a function in the first sentence and I made it a bit softer to make a more friendly first impression. I mentioned the app's name to remind the user what's going to help them (branding, be proud of your creation). I stayed true to your intention, the reference to 'real life', but made that a bit softer as well by using "might" and not mentioning a negative word like "lose". We're all winners here!
Part 2 - Current
"To let us know this information we will run a service in the background to monitor the use you make of your smartphone.
Quiet!, it will not consume more than a little bit of the precious battery of your mobile..."
Part 2 - Suggested
"You're probably wondering how much battery this app will consume. Don't worry, just a tiny bit.
Think about the time you will save after gaining all this usage intel. You won't even need as much battery anymore."
Part 2 - Motivation
Shouting "Quiet!" doesn't come across very friendly. There's also never a comma after an exclamation mark. I wrote the text to match the battery icon better. I'm also pushing the major goal of the app forward.
Part 3 - Current
"We will give you more information if you let us see how do you use the apps in your device..."
Part 3 - Suggested
"Sorry to bother you but I will need some usage access in order to provide you with all these awesome statistics. Is that okay with you?"
Part 3 - Motivation
"let us see" gives the impression multiple people or a company will be watching along, which totally isn't the case. I wrote it a bit more personal, fun and friendly.
Part 4 - Current
"Do not worry!
The data we collect is NOT sent anywhere."
Part 4 - Suggested
"Do not worry!
The data I collect is NOT sent anywhere."
Part 4 - Motivation
As in part 3, It's better to speak from a first person point of view, "I" instead of "we". It's just the app and the user, "you and me", which is a more comforting thought.
Instead of "START APP" I'd use something more vivid like "Lets go!" or "Show me some numbers!" or "Start saving time!"
The UDPA looks good, people are used to not reading these disclaimers and accepting them anyway. It's also a nice reminder that even if there is a "we", it's literally stating no personal data will be collected on any server. Kudos! :highfive:
I personally don't like the last paragraph but ah well, one has to make a living, right?
Looking forward to those stats...
Timmmmaaahh said:
Heya! Congrats on making the portal. Good stuff you got there.
Here's some suggestions for the intro texts:
.
Click to expand...
Click to collapse
Thanks, thanks, thanks!
I have updated the app with your suggestions.
English isn't my matter language
MaXX99 said:
It would also be nice to be able to monitor a remote phone (opening up the app to for parental monitoring for example).
This could be achieved by either allowing to :
- send a daily report by mail
- having a client app with data synced whenever a connection is avaialable
- sending data to a central server
...
Click to expand...
Click to collapse
I need to think on it.
I would not like it to be used without consent to spy on anyone :/
legendnexus said:
anyway to export the data as .csv ?
Click to expand...
Click to collapse
Sounds pretty good.
I have added to the ToDo
panfiluta said:
Hello, thanks for app!
Any chance to remove "full network access" from permissions in future ?
Click to expand...
Click to collapse
Sorry, but Internet permission is needed to display Ads.
I understand that you do not believe in my word when I say that I am not sending data anywhere, but I need to access the Internet to load the Ads
Please add export data functionality! Csv format for example. Great app otherwise, thanks!
Crashing
Hi,. Unfortunately the app crashes every time I open it on my OnePlus 6 that runs Android 9. The first time run screens work fine and permissions are assigned ok but then I can't open the app. I have tried clearing the storage/cache and that hasn't helped. Any ideas what to try next please?
Hi
Assuming you're rooted, please, post a logcat or send by email.
Thanks
Peteba said:
Hi,. Unfortunately the app crashes every time I open it on my OnePlus 6 that runs Android 9. The first time run screens work fine and permissions are assigned ok but then I can't open the app. I have tried clearing the storage/cache and that hasn't helped. Any ideas what to try next please?
Click to expand...
Click to collapse
bartito said:
Hi
Assuming you're rooted, please, post a logcat or send by email.
Thanks
Click to expand...
Click to collapse
Sorry no not rooted..
Peteba said:
Sorry no not rooted..
Click to expand...
Click to collapse
OK, I will try it by my self
Hello
I've tried but no luck reproducing the issue.
If possible, enter app settings then enable debug mode then reproduce the issue then sent the log file.
If not possible, please, contact by email or PM to receive a debug version of the app to track the issue.
Thanks in advance
Peteba said:
Sorry no not rooted..
Click to expand...
Click to collapse
Peteba said:
Hi,. Unfortunately the app crashes every time I open it on my OnePlus 6 that runs Android 9. The first time run screens work fine and permissions are assigned ok but then I can't open the app. I have tried clearing the storage/cache and that hasn't helped. Any ideas what to try next please?
Click to expand...
Click to collapse
I have the same Problem on my OnePlus 6 (A6003) running Android 9 (OxygenOS: 9.0.4)
max_m42 said:
I have the same Problem on my OnePlus 6 (A6003) running Android 9 (OxygenOS: 9.0.4)
Click to expand...
Click to collapse
I have answered your PM
hi, in my view for PRO version i would like to keep data live for 365days and to export them in csv in order to analize with spreadsheet or other stuff.
thanks

Digital Wellbeing apps

Hi!
I'm new here and I'm developer. Unfortunately, I can't post my app to XDA: DEVDB yet. But I can ask the community something at least.
I'm working on the app for Digital Wellbeing. The goal of the app the same as for all digital wellbeing apps. To reduce mindless smartphone usage.
So, my questions are:
1. Do you use any Digital Wellbeing apps?
2. What are these apps? App Blockers? Screen time stats?
3. Do you think screen time and all that Digital Wellbeing stuff are important?
Thanks,
UPDATED:
App posted to XDA Dev DB: https://forum.xda-developers.com/android/apps-games/app-acture-app-reduces-mindless-t4095947
Yes we use digital wellbeing app to limit our screen time...
Can your app function like one plus zen mode??
Saadatrm said:
Yes we use digital wellbeing app to limit our screen time...
Can your app function like one plus zen mode??
Click to expand...
Click to collapse
The app is a bit different. The main idea is to ask the user to type a reason after every phone unlock. By doing this user defines a goal before using the phone.
What do you think about it?
Q1. is it open source?
Q2. can it work without google or gapps?
Q3. dark mode presnt?
Q4. Root/non root
Q5. when it will release?
pls provide link after release
Best Wishes frm me.
markmywordz said:
Q1. is it open source?
Q2. can it work without google or gapps?
Q3. dark mode presnt?
Q4. Root/non root
Q5. when it will release?
pls provide link after release
Best Wishes frm me.
Click to expand...
Click to collapse
Q1. No
Q2. Yes it's offline app at all.
Q3. Not yet.
Q4. Non root.
Q5. Already released.
I can't post links yet. App name is Acture.
yarsanich said:
Q5. Already released.
I can't post links yet. App name is Acture.
Click to expand...
Click to collapse
Is this it?
KelvinCrag said:
Is this it?
Click to expand...
Click to collapse
Yep. I will post as DevDB ASAP.
yarsanich said:
The app is a bit different. The main idea is to ask the user to type a reason after every phone unlock. By doing this user defines a goal before using the phone.
What do you think about it?
Click to expand...
Click to collapse
The concept is very good!!!
Implementation is a bit disappointing...
Saw some reviews on ps...
App doesn't always start by itself,, sometimes late,,,
That dismiss option..... ?
But keeping in mind it is still in early stages,,, it is doing its job well
Lastly keeping the app open in background, how much battery does it consume...
N if possible, make a root version too for force implementation...
Nice work though
Keep it up
To reduce mindless smartphone usage.I am currently using app-forest,This is a really great app.

Categories

Resources