What I want is to access the time (in milliseconds) that each application is used.
Thanks
Dig up the source to "Spare Parts" and see how they do it
(also copy it off the emulator, install it on your phone and make sure it works)
Note: while this remains accurate for the circa-2010 versions of Android about which it was written, restrictions added years later in 4.4 and 5.0 would substantially frustrate achieving this in more recent versions.
You could use TraceView. Did you mean by programming?
By Programming, You can check out how SpareParts does it.
#João Lopes,Chris Stratton
Google Provide the sample code for AppUsageStatistics Sample
Here full of statistics base on daily weekly monthly usages.
Firebase Analytics has a cool feature where it tracks the average time on each screen and the percentage of which screen is used most often.
Is this is good enough for you, I would suggest adding Firebase to your app, as it has a free plan, and it will automatically track your users' time. You can start here
Hope this helps
you can try to use FireBase Analytics.
Related
I have implemented an in app subscription in Android, it all works fine, I even have a 30 day free trial to begin with.
I have a referral feature in the app, so when a certain value in the database reaches 10 (i.e. 10 referrals) - I want to give the user a free 30 day subscription.
I have had a look around and think deferring the subscription by the desired amount would the solution. However, I have no idea how to go about this. The api docs dont seem to be Android-specific, and I cant find a proper tutorial anywhere. Any help massively appreciated.
Already tried looking at the docs - https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/defer
Do I just make the http request listed there? I was hoping for a nice in-built call I can make.
I simply wish for:
when a certain variable == 10, to defer, or increase the subscription length by 30 days.
Cheers mate.
Currently this is the only official way to do it. You may try to find some third party library on github, but I would not count on it.
I would recommend you to use Retrofit and create this call by yourself.
Maybe in (the) future Google will include this method as a default one in its billing library though - we just have to wait)
Hope it helps, mate.
I was trying to make a fitness app and I wanted to use Google Fit, I watched the code samples they provided in the documentation and managed to get the step count per day, but now I would like to make my app to register the starting time and end time between which the use ran. I really did not understand too much from the Sessions API, because I think that is the solution. Can anyone please help?
Have you checked the following example? This is pretty much what you are after i believe
https://github.com/googlesamples/android-fit/blob/master/BasicHistorySessions/app/src/main/java/com/google/android/gms/fit/samples/basichistorysessions/MainActivity.java#L227
I am a long time lurker on Stack Overflow where generally the solutions I sought already existed on here. However, I am stumped trying to find information on tackling this problem.
Basically, I am looking at making an Android app - first time making such an app - and part of the functionality is to monitor what else the phone user is doing and then maybe create a log of what the person has done. For example, spent 27% of the time when the phone screen is on using Facebook.
As for my actual Android Studio experience, all I have created so far is a simple app that takes in text from an input field and alerts it back out to you. I am studying a video series to learn how to use and develop with Android Studio.
I am enthusiastic about the challenge, so if anyone has some good resources or information to help me achieve this I would be really grateful.
Yes it is possible to track applications usage, using google API.
Here is google resource link
What may interest you the most is the part concerning UsageStats
You can use this since api 5.0. You can then for example use method getTotalTimeInForeground() to get the total time this package spent in the foreground, measured in milliseconds, which seems to correspond to your needs.
Therefore, using your Facebook example. After you get the package name (com.facebook.katana) , you could get the application (Facebook) uptime on a daily/weekly/monthly base.
Also, you could use getLastTimeUsed() and make your application logs those timestamp then do some maths.
I am pretty new to the android app development and I would like to develop an app about geofencing. Under my understanding, geofencing can be related to my own database stored in the device memory and it has a limitation that only 100 geofencing can be used at the same time. (Actually I am not sure if my understanding is right. If it is not, please correct me.)
My question is: Can I store several lists of geofences in my device and only enable the list which I want using the app? so, I can have more than 100 geofences but use less than 100 at the same time.
Short answer: Yes, you can. I'm not sure what the exact space requirements would be but I don't see a problem in saving several lists of 100 entries each.
For more information on how to save data in Android I'd recommend looking at this training module. You don't have to save the data - you could just keep it in working memory and redownload the lists every time. Maybe that would make more sense in your case, I don't know.
What are the best practices on updating the apk files in the Android Market ? Is it ok to publish a new version as soon as i fix a minor glitch or should i consolidate a few bugs (if those or minor) and post it in a regular interval. Just released a game and got a extremely corner case crash issue and another minor glitch so i'm not sure if i release the fix right away.
Also are there any restrictions on the number of updates per time period ?
Even if there is no best practices as such could you (android developers) share how frequently you update your APK files for minor and major issues and what's your positive and negative experiences ?
Thanks!
Once a week is pretty optimal for generating new downloads and visibility. Based on my experiences and what I have read. Also weekends and holidays seem to generate more traffic.
I usually pack more changes into one update and release once in 1-2 weeks. Don't make updates if you have no real content. That may annoy users.
Read story #1: http://blog.edward-kim.com/an-android-success-story-13000month-sales-0
Read story #2: http://makingmoneywithandroid.com/2011/05/first-month-on-the-android-market/
People's experiences: Android Market - Time to wait between two updates
Market's "just in": http://www.google.bg/support/forum/p/Android+Market/thread?tid=5b8adbb9052fc55c&hl=en
Analysis when during day is most downloads: http://nhenze.net/?p=735
Discussion about time of day: Best time/day to publish to Android Market?
Personally, I think it depends on the type of application. If you are coding a type of tool that obtains more and more functionality with each update, users probably won't mind the frequent updating. Same goes for an application that has too many major bugs.
If you're coding a game though, I think updates relating to style of gameplay should be few and far-between. Users get used to playing a certain way and could get annoyed if they have to keep adapting to what essentially is a different game every time they update. Level pack updates are of course a different story though (I think those don't come fast enough sometimes).
Remember though, even if an update goes out for an app, it doesn't mean the user will download it. I've seen too many friends with 22 updates available... < drop down clear >
As far as I know you can update as often as you like. You pretty much have to decide what the balance is between annoying your users with frequent updates vs. making them happy by getting frequent bug fixes. For a while I was updating my own apps pretty much weekly and I never had any negative responses to that.