Can os and Home screen update the android app widget at will? - java

I want to make and app with widget to present some data,and i want to be sure it will not become a battery drain source and add all the checks i have to,so there is no problem.
So android documentation actually says that ACTION_APPWIDGET_UPDATE may be sent in response to a new instance for this AppWidget provider having been instantiated, the requested update interval having lapsed, or the system booting.
But i came into this bizarre answer here
Android widget update called twice after device boot
that suggest that the home screen can actually update your widget n times at will.Seems bizarre,and i cant find something similar,do i really have no control over this?

As in the previous answer you found, there is no way to limit how many times the home screen might update the widget - it is responsibility of the homescreen and you cannot control this.
You could add a limit in your update implementation instead. For example, record the time the checks are made. If the widget update is requested again too soon after the last one, ignore it until the required amount of time passes.

Related

Thumb detection Using Secugen's FDxSDKProAndroid.jar library

I have developed E-Attendance System using Secugen's FDxSDKProAndroid.jar library.
When user put his/her thumb on machine, machine automatically detect thumb and process it further. But issue is that if user do not move his thumb out of machine's screen then machine process again and again.
I have added a delay of 5 seconds of reprocessing but again its not a valid.
So I want a solution like once process is completed, library tell that still thumb has not moved out of screen, or just like a variable that return false if thumb has not moved away and return true if moved away.
Thanks in advance.
I can provide more information if required but please help me out.
Following is code snapshot that process when thumb is detected:
Maybe there is a place in your API or in your code where there is a flag on auto capture. That may not be the case but if I were in your shoes I would be forced to tie the event of fingerprint capture to only happen after the event of fingerpint removed has been fired when there is a fingerprint template that was extracted from a previous fingerprint capture.
I do not have access to your API so I won't be able to tell you exactly which method to call after the other but if I did I could explore its objects and tell you how to go about it.

Is it possible to modify the time OSCeleton sends a lost_user event/message?

I'm playing around with OSCeleton and Processing and succesfully got to track skeletons and do stuff.
What I'm wondering is if there's any way to change the delay time a "lost_user" message is sent to Processing.
This is taking so long for what I'm trying to achive, since i need to stop tracking a user as soon as he goes away from the screen, so I can accept another user's interaction. (imagine an installation where a lot of people wants to play with).
any help/tips would be really appreciated.
Jon
As far as I can tell from the OSCeleton's source and with my minimal experience with the kinect(I never used OSCeleton), there is no way to modify that code to do that. It seems to be a thing handled even lower, by the driver or by the kinect its self(?).
Yet you need not bind yourself with that, and I would suggest a couple of ways to bypass the problem if I understand properly.
First, the latest drivers and examples should have multi-user support, meaning you can just arrange who is your main user. From what I can tell from the source you do get an osc message in Processing when a new user is detected as well as an ID number. You can put each new user that arrives, into an arrayList and figure out a way to do things without depending on the latest user.
If you are still going for the user-after-user thing though, or I was mistaken about the multi-user support(which is mentioned nowhere in the README), you can check yourself whether a user has left the area. Although you can not get a definitive answer like that you can check for example, whether a specific joint or all joints of a user have moved in the last 10-20 osc messages received. That probably means storing the position of this joint in an 10-20 item array and continuously updating while also doing a check on whether the items are different. If all items in the array are the same, your user has not moved a bit and thus probably should not be taken to account.
Last but not least you can switch to other solutions. The one I used about a year ago was "Synapse for Kinect" which also seems stale now. The latest you can use is a Processing library called SimpleOpenNI which definitively have multi-user tracking and you won't need any intermediary programs running to give you the joints.
I hope this helps

Fastest way of getting a list of installed packages in an Android device

I'm getting a list of packages installed in an Android devices very similar to the code here - http://www.androidsnippets.com/get-installed-applications-with-name-package-name-version-and-icon
The problem is that it takes quite a while to complete detection of all apps. I've discovered that the slow operations are those that call p.applicationInfo.loadLabel() and p.applicationInfo.loadIcon(). Once I comment those out and set them to dummy info, the detection is almost instantaneous.
Since I would still like to retrieve the app name and icon, I can't simply comment them out. Is there a faster way of retrieving this data?
Thanks.
You should populate the list with the names of the applications first and placeholders in place of the icons.after this another thread should fetch the icons sequentially and list should be notified for data set changed every time.

How can you send the exact number of notification (the number next to your apps) to facebook instead of each time we make a request?

I'm trying to have more control on the number we have next to our apps for the user, How can we just send the exact number to show instead of sending notification that increment that number each time.
Basically the current behavior is :
Friend ask for something or give me a gift it increase the number
If another friend send me something its increase the number.
When I log to the game all the counter is reset.
Wanted behavior :
When I log to the game and i go see only one friend on the counter for this friend is reset.
We are currently using facebook-java-api but we will probably merge to restfb soon.
But if you know how to do it in any language it will probably help.
The old dashboard api support the set_count method that can reset to 0 or put the value you want for your apps.
See http://developers.facebook.com/docs/reference/rest/dashboard.setCount/
However the facebook-java-api don't support setCount but the newer restFB does so we need to update our apps to the new api.
EDIT: Note that you and extend the BasicClient and create a custom IFacebook Method with facebook-java-api it`s not clean but it do the trick utils we upgrade to a new facebook api.

Android Camera autofocus when user holds camera still

I'm sure most of you have used an android phone before and taken a picture. Whenever the user changes the mobile phone's position and holds it steady, the camera focusses automatically. I'm having a hard time replicating this in my app. The autofocus() method is being called only once when the application is being launched. I have been searching for a solution these past 3 days and while reading the google documentation I stumbled upon the sensor method calls (such as when the user tilts the mobile forwards or backwards). I could use this API to achieve what I need but it sounds too dirty and too complicated. I'm sure there's another way around it.
All examples on the internet which I have found only focus when the user presses the screen or a button. I have also gone through several questions on SO to hopefully find what I am looking for but I was unsuccessful. I have seen this question and that String is not compatible with my phone. For some reason the only focussing modes which I can use is fixed and auto.
I was hoping someone here would shed some light on the subject because I am at a loss.
Thankyou very much for your time.
Since API 14 you can set this parameter
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_CONTINUOUS_PICTURE
Yes, camera.autoFocus(callback) is a one-time function. You will need to call it in a loop to have it autofocus continuously. Preferably you would have a motion detection via accelerometer or compass to detect when camera is moved.

Categories