Finding battery current (mA/mAh) on Android Tablet - android

I'm creating an application, and I need to be able to get the battery's current (mA/mAh). I have the voltage/temp/level etc and this is the final thing I need to get, and coincidentally the hardest too.
I've looked at CurrentWidget source code and searched Google high and low, and I have all the classes/methods to pull the data out, it's just the path to the file containing the current which is stopping me from getting it.
"CurrentWidget" contains a lot of different paths to the file (for various devices) but none of them work on my ASUS EEPad Transformer on 4.0.3, which I need it to be working on as it's my testing device and all I can get my hands on. I've been in to the adb shell and dug around the root of the tablet for hours but I can't seem to find anything apart from things like name, temp, voltage_now and others which I already have. They're all stored in /sys/class/power_supply/battery, but there's no "current" like I expected, and like there seems to be on other devices.
Thanks for any help, I know this is a long one!

Related

routingError became GRAPH_DISCONNECTED all of a sudden

So I am one of several developers developing a GPS-app with the help of HERE SDK for Android.
This is a project that has been in the making for some time and it has been a somewhat smooth ride, until yesterday.
We have a couple of tablets to test our app with, and yesterday when building on the Samsung Galaxy Tab A(2016) the routing always gave us "GRAPH_DISCONNECTED" as an answer.
It doesn't matter what route I try. From current location. From a set location. The destination doesn't matter either.
So we have a CoreRouter.Listener that overrides the onCalculateRouteFinished-method and no matter what I do routingError seems to beceome GRAPH_DISCONNECTED.
I have tried to uninstall the app and install it again. Same result.
I have tried deleting the cache for the app. Same result.
The weird part? It has been working on the tablet for well over a year.
And if we use any other tablet, like the Xperia z4 tablet there is no problem with the routing.
Okay, so problem found!
Apparently, we had the wrong settings for the vehicle. It was too big to go from the positions we tried with, and that's why HERE couldn't make a valid route.
The strange part is that this route has worked with those vehicle settings before. So some construction must have come up all of a sudden that stopped me from making the same route.

onUpdateNavigationState() error

I am in the process of upgrading from Skobbler 2.3 to the latest 2.5 and I am picking up an error with navigation.
When onUpdateNavigationState() is called, all data in the SKNavigationState object is always empty. For instance, getCurrentAdviceDistanceToAdvice() is always 0, getCurrentAdviceCurrentStreetName() is always "" etc. The only value that is consistently populated is from getCurrentAdviceTimeToDestination(), but that value is always incorrect. The value should be in the region of 16 hours, but is more like 440 hours.
Other problems are:
Visual advices are not displayed correctly
Audio advices are not heard, both when using Text to speech and when using audio files
Interestingly, the route is calculated correctly. The map is displayed correctly, complete with road names etc. The map can be panned, zoomed etc correctly. When navigation is started, the calculated route is displayed correctly and when using the simulator, follower mode is activated correctly and the vehicle follows the calculated route. However the SKNavigationState object always contains empty values even though looking at the map, I can see the name of the road displayed.
I've checked SKMaps.zip and the correct language files are included etc.
Originally, I tried upgrading from 2.3 to 2.5. After this failed (i.e. with the problems above) I abandoned upgrading and now I am unzipping SKMaps.zip to a completely new location on disk, but the problem persists. No preloaded maps are being used.
The problem occurs even after uninstalling the app. I've tried installing on a completely different phone and the problem still remains.
None of these were issues with the 2.3 API which just worked. Any help would be appreciated.
Test phones:
Galaxy S3 running Android 4.3
Galaxy Note 4 running Android 5.0.1
I got the same issue several weeks ago, I found out that the paths where the Advisor files (audios, advices and other files) were wrong. I'd recommend you to debug the application where the AdvisorSettings files and paths are configured and double check whether those paths are well configured and the files inside them are properly located.
Regards.

How do I ensure that the layout on android studio matches the output on the emulator?

I don't know the answer to the question posted at https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=155879.
How do i sort it out please as I was kindly asked to refer this and other questions here?
For one, your emulator is using a Nexus 5 layout, and your preview is using a nexus 4. This is causing the difference
For two, please don't link to external sites with your question, but posting it directly on SO it ensures that others who come in the future will be able to see the question (what happens if the external site goes down, or changes it's link structure)
For three, please make your layout flexible to different screen sizes as you will not be able to control what devices your users will be running your app on. (unless you are only using this app in a controlled environment, and not releasing it to the public)

Corona SDK - buttons and character sprite animations not showing up on my phone, but is fine in emulator

My situation in a nutshell : http://i.imgur.com/wUpMgX5.jpg
This is my main.lua file: http://pastebin.com/1t2rhim1
Anything in main( ) starting in ---PLAYER--- does not show up when I try to play the .apk game on my Samsung Galaxy Note II. Everything is fine as I intended when I simulate it on the computer.
My game is basically a title screen, where I press on a word and then it jumps to displaying a background and draws out a D-Pad, 3 buttons, and 2 characters with their HP/MP bars, whereby it becomes a fighting game. However, only the background appears.
I've tried disabling the background, but the other images just do not appear.
I don't know if its because my Corona SDK is not the pro version, so there's a limit to how much I can draw, or,
There's issues based on the screen resolution, however I have been coding this game with a Galaxy SIII or Note II resolution in mind (1280 x 800), so the characters shouldn't be appearing off screen or anything.
--
And if that works, I don't understand how to have an infinitely updating loop. I am semi-familiar with Java, a bit less so with Python, and totally new to Lua. I want to modularize my code more as well.
How do I loop? I want to get an AI working, but currently that code is only run once. I tried putting a while-true-then loop at the end of my main function, but it crashed my simulator.
Not sure why your sprites wouldn't be showing, but not having the Pro version is NOT the problem. The free Starter Edition of Corona SDK can do everything the Pro version can do except in-app purchases.
I don't see anything wrong at first glance in your code, but did notice the files that load, like the background image, are stored in the root of your project, at the same level as main.lu -- while the sprites that don't load are down in subdirectories. First thing I'd do is check the names of those folders - are the folders Dennis and David actually capitalized the way you have it in you source? The simulator won't care, but the device will.
As far as the infinite loop goes, you can create a Runtime listener that can call a function every frame, like this:
Runtime:addEventListener("enterFrame", myUpdateFunc)
That myUpdateFunc function will be called 30 or 60 times per second, depending on how you have things set up in your config.lua file.
[EDIT: Looking again at how you're calling for the sprites, do you really mean to have the slash in front of Dennis, etc? Even if the case is correct, I'm not sure you mean what you're saying in that code. :)]
Android and IOS are based off linux that means its case sensitive. Its a common problem that people don't care about the case when creating display object or playing files or just loading story board scenes. It means that the game will run fine on a windows system but it won't run properly in linux.
Try checking the files you are referring in the code matches the file names in the project folder (check the case of the file name).
Hope that would fix your problem.
Make sure you you are not running into the typical problem of file name case sensitivity. The simulator ignores the case of the letters that make up the filenames, where the device is sensitive. This is easy to over look and miss. Check all filenames, not just images. Check your audio, your .lua files etc.
Also make sure to tether your device to your computer via the USB cord and use the "adb logcat" command and make sure you're not getting any errors on device.
There are only 3 reasons for that:
1. file name case sensitivity
2. Texture memory is not supported for your device.
3. There is some error in the code.
All these can be checked by putting print statement and connecting your device to computer and see logs by using "adb logcat" command.
Its because you created the background first. Move it to under the buttons and images and it should work.

How to test android application?

Developed a application of size 40MB. I need to test it for all screen support but the android emulator really a bad choice(I feel... ). It gives Insufficient memory error almost every time). How developer test their application?
One more Question
I have designed app for four different layout(normal,small,large and xlarge). Will every device(In future) satisfy these layout params?
And i faced a real problem that i tested my app in Sony xperia minpro(Small screen 240*320 2.4inch) and in Samsung galaxy 5(smallscreen 240*320, 2.8inch) but the layout is overlapping in samsung device. This can be a serious problem , actually we cant check our app in every device.. that is impossible too.
TIA
40MB is way too big for an Android application. Many users will have problems installing the app on their devices. You should consider moving some resources out of the application and downloading them either on demand or on first app run.
The list of layout types (normal, small, large, xlarge) is definitely not final, for there quite possibly will be even larger screens (xxlarge) or tiny ones (xsmall?).
Developed a application of size 40MB. I need to test it for all screen
support but the android emulator really a bad choice(I feel... ). It
gives Insufficient memory error almost every time). How developer test
their application?
You can configure the emulator with any amount of memory you wish, including an emulated SD card so memory shouldn't be a problem. However, 40MB is quite big so you may be hitting the package size limit.
One more Question I have designed app for four different
layout(normal,small,large and xlarge). Will every device(In future)
satisfy these layout params?
You're asking us to predict the future - there's no way we can know what Google are planning if they haven't already announced it though I would suggest that there will never be a commitment to keep screen sizes or resolutions static - technology constantly evolves and specs that are OK for today, will not be OK for tomorrow.
I have seen dictionaries weighing in at 40Mb, best practise is to download the database as a separate file. Some graphically intensive games approach that size. If you want to emulate many Android devices make sure your PC is up to snuff and you have the latest SDK.
How developer test their application?
You do not have so many choices: you have to use as many (and different) physical devices as you can, from different vendors and technical specifications (screen, etc), to try to detect as many specific bugs as possible.
This is difficult, as you are often limiten to a few physical devices.
To give you examples, I recently struggled with the Camera, for a bug happening with Motorola Defy only. I am currently struggling with the Camera, but only for Samsung Galaxy this time.
When you find a specific bug, try to fix it "the general way": instead of detecting the vendor/version of the device to write specific code for it, try to enhance your code in a way it will work for all tested phones. So far, I never had to write anything specific to a given device. The bugs I encountered were always tied to a permissivities or particular cases that could be handled by making the common code more complete or resiliant. Let's say by "making as less assumptions as possible" knowing that we tend to make assumptions without meaning it.
On top of testing on as many physical devices as possible, create emulators. You can parameter them to have different screen layouts, different embedded hardware, memory, etc. And on top of the default emulator that comes with the Android distribution, you also have emulators provided by the devices vendors and that reproduce the specificity of these devices. For example, Samsung released a Galaxy Tab emulator. Sony Ericsson released a EDK Cellphone emulator. You can get them thru the regular android distribution update workflow.
Will every device(In future) satisfy these layout params (normal,small,large and xlarge)?
Yes, as Android distributions are backward compatible. Any of these layout will still be supported in the future, but may become 'deprecated' (so not recommended, but still working), and new layout types will certainly be created.

Categories

Resources