isIgnoringBatteryOptimizations not working for Samsung - android-doze-and-standby

I am testing my new app and I have an issue with the
isIgnoringBatteryOptimizations
feature.
When the app starts it checks if the app is whitelisted for Doze. If not, it displays a message to the user because the app needs to be alive and cannot not be killed.
It works well for several devices and emulators but I am having 2 SAMSUNG devices for testing and in those cases the value of isIgnoringBatteryOptimizations is always false. Not matter what the user does (adding the app to the ignore list of doze and all that) the app always thinks that is being optimized so it always displays a warning message.
Any ideas what could be wrong for those Samsung devices?
This is the code I use:
PowerManager oPowerManager = (PowerManager) MyContext.getSystemService(Context.POWER_SERVICE);
boolean b = oPowerManager.isIgnoringBatteryOptimizations( MyContext.getPackageName() );
"b" is always false for the Samsung devices I have tested.

Mine did the same on an S5, but after a reboot of the phone, it now works.

Related

safari 13.1 navigator.mediaDevices.enumerateDevices() return only audio devices

Im facing with an issue on desktop Safari 13.1 version. If I open the console in the web inspector (with a regular macbook which has webcam and mic) and execute this command on any kind of website:
navigator.mediaDevices.enumerateDevices()
First time it will return in the Promise result with a videoinput and an audioinput.
Second time it will return only 2 audioinput. Videoinput is disappear.
Unfortunately I call this method several times while checking the available devices on my solution.
Any idea why does it happen and how could I get the accurate information about the devices even If I call it more than once?
See the results here
I've found the same issue, also on my iPad running iOS 13.
It seems you need to request camera access first in order to see the correct device list.
navigator.mediaDevices.getUserMedia({ video: true })
This will prompt you for access to the camera (you need to be on HTTPS or localhost).
Grant permission, then run this again and you should see the videoinput device(s) listed in the returned promise:
navigator.mediaDevices.enumerateDevices()
I guess this makes sense as a privacy feature that a website cannot check if a camera exists without first asking your permission.

How to simulate the status bar in Codename one?

I am currently trying to get a local notification to work on an example app. I was following the simple guide here and just copied its code to see it working:
https://github.com/codenameone/codenameone-demos/blob/master/LocalNotificationTest/src/com/codename1/tests/localnotifications/LocalNotificationTest.java
However, in the simulation, I cannot see any changes in the status bar. Is the status bar even simulated or just a static image? Do I have to build the app and send it to an actual device every time I want to test it? That would not only be tedious but also crunch on the available monthly builds.
Is there a setting in the simulator to activate this that I missed?
Thanks and best regards
Local notifications happen in the background which isn't supported by the simulator so this is something you will only see on the device. You can simulate the minimizing of the app (pause/resume) but the Codename One simulator is not a full mobile OS simulator.

Worklight persistent busy indicator

I'm working on a project using IBM Worklight and any time I build and deploy my project on any simulator or device, I have this busy indicator spinner in the middle of the screen. Its always there, on every page and its there in the ios, windows, web and android simulators as well as one android device we've tested on. Has anyone seen this before and if so how would I get rid of it.
Jquery-mobile was the problem, it was continuously displaying the indicator for seemingly no good reason. Deleting Jquery mobile fixed the problem
I already used the native worklight loading.It is very good and I tested it on different platforms, devices. But it is necessary to close it when you leave the function that opened it.
Example:
var busyInd = new WL.BusyIndicator ("content", {text: "Please wait..."});
function consult(){
busyInd.show();
//impl
busyInd.hide();
}

iCloud Document hardly sync after first launch

I'm using UIDocument method to store data in iCloud.
So I have 2 devices to test, when I first launch the app on iPhone, then I do some changes then call saveToURL:completionHandler, after that I launch the app on iPad, it's working good, at least it does retrieve the data from Cloud server.
My problem arise after both have their local Cloud storage. Now I made some changes on iPad, then I switch back to iPhone, I noticed the iPhone still having its old data, not the changes that iPad did earlier.
Does anyone know what's the problems? I even try to turn on/off Document & Data in iCloud setting then re-run the app but no luck, it's still doesn't working.

ToastNotification during Quiet Time

I have developed a desktop application which displays ToastNotifications while the user is in Metro Mode. When clicked it will bring the user back to the desktop mode where a standard desktop notification is presented.
This all works fine except when Windows is in QUNS_QUIET_TIME. The desktop notifications do not get displayed as expected, but the ToastNotfications still get displayed. My client wishes for the ToastNotifications to not display during Quiet Time.
The code calls SHQueryUserNotificationState which returns a QUERY_USER_NOTIFICATION_STATE enumeration. The provided link says the following:
Note that during quiet time, if the user is in one of the other blocked modes (QUNS_NOT_PRESENT, QUNS_BUSY, QUNS_PRESENTATION_MODE, or QUNS_RUNNING_D3D_FULL_SCREEN) SHQueryUserNotificationState returns only that value, and does not report QUNS_QUIET_TIME.
This is what I am experiencing. The call to SHQueryUserNotificationState is returning QUNS_APP (A Windows Store app is running.) and not QUNS_QUIET_TIME.
Does anyone know of another way to determine if QUNS_QUIET_TIME is in effect or a way to force the toast to respect quiet time?
Desktop notifications use different settings than toast notifications. You can find toast notification settings here. When a user sets notifications to one hour from Windows 8 Settings | Notifications, the app will not be able set toast notification. Try the example "sending toast notifications from a desktop" here (either C++ code or C# code).