Can anyone explain me that how can i get the configuration of Android device programatically in my app.
Also how can I get the other device related information like Battery usage,CPU load,RAM usage,Memory details etc programatically.
Thanks in advance.
This will get you started for the battery:
Android Battery in SDK
And this will get you a bunch of system properties (look at the getProperty method):
http://developer.android.com/reference/java/lang/System.html
Also these threads on memory management will provide a place to start:
Get Memory Usage in Android
How to get current memory usage in android?
You can use package Manager, using package manager you can get it
Related
Is there any way to find out CPU usage of my Android application programmatically? I'm aware of this question already, but it is about Corona SDK.
Note that I want to do this on non-root devices.
Any help would be appreciated.
I am not sure about programmatically, but you can use Android profiler to achieve the same.
Run your application, either in a physical device or emulator (doesn't matter here)
When the application is running, you will see a Profile tab in the toolbar
If you don't see a Profile tab, you can access the same using Run > Profile 'app'
Edit
Check this answer
Edit 2
You can use firebase performance monitoring for runtime data collection about performance. Follow this link
I just found a way to calculate the CPU usage of a process by PID. According to the doc, the /proc/[pid]/stat file contains status information about the process. So we can parse this file to get the following members:
utime %lu
stime %lu
Check this page to get more information about the /proc/[pid]/stat file and the way to parse it.
Also here is a relevant question about utime and stime.
I'm trying to get the application usage list in android lollipop using UsageStatsManager, for that I have gone through the android developer document https://developer.android.com/reference/android/app/usage/UsageStatsManager.html
I don't know how to use UsageStasManger, so I referred few links How to get list of recent apps with Android API 21 Lollipop?
Android Lollipop know if app as Usage Stats access
and implement in my project but I didn't get any data from UsageStausManager? how do I Use UsageStausManager in my project. Anyone help me out.
From lollipop we will not be able to use the activity manager for determining the current foreground tasks. we have to make use of the Usage Stats Manager. Wrote a small code and answered in this thread
Determining the current foreground application from a background task or service
You can have a look at this thread by me.
I am working on an app that will access different items in the phone status screen for work. I need to be able to get specific software information from the phone to populate in the app. For example: in the droid x, the system version shows as 4.5.605.MB810.Verizon.en.us . This is the software info I need to auto populate. I have tried all of the Build options from the android developer site and I have even tried the SYSTEM_VERSION string from telephony, but they all provide information other than what I need. Can anyone tell me how to reference this software information please?
Check out android.os.Build. Here are the details:
http://developer.android.com/reference/android/os/Build.html
And for OS version specifics, use the nested class Build.VERSION detailed here:
http://developer.android.com/reference/android/os/Build.VERSION.html
Check the Settings app code for where it gets its information.
Is there any way to modificate Phone App? I need to add some caller's info on it but I can't find way to do it/
You could check the android sources http://source.android.com/source/index.html, try to get the correct sources and build your own app.
Whether i should should use sysout or Log.x en-order to debug an android project. I think both are writing to file. Me, commonly using sysout and use filter in LogCat to get it easily. But most of the tutorials and sample i see it is mainly using log.x
What is its basic difference? any link or tutorial for that? Which is better to use?
Thanks
Hai Labeeb Brother, You can refer this from andbook which may download from the following site using your facebook account itself
http://www.docstoc.com/docs/57705463/Android
if downloaded that book, pls go through the page number 45 and 46. this will give clear idea brother.
refer those pages of the book ,in the following image brother
In general, it's a good practice to avoid using sysout (even when using standard java development).
Using the Log object gives you support for tags and priorities.
Logcat has built-in filtering capabilities on tags and priorities.
There's also a performance gain when using the Log object properly, as writing a lot of info to the output stream can be an expensive operation.
The Log object also exposes an isLoggable that allows for selective logging (depending on tag and priority).
Information on viewing the log output can be found here : http://developer.android.com/guide/developing/tools/adb.html
Information on the Log object can be in the Android Developer Reference under android.util.Log
Some options for viewing your log output on your android phone can be fuond with the following Google query : android logcat viewer phone