Screen blacks out in app designed with codename one - codenameone

I have made my app with codename one.
I faced this strange issue:
I left my phone idle for a while and went to do some work.
After say about 15 mins, my screen had gone black while my app was still running.
SO when I activated the screen, all I got was a black screen. My app was nowhere to be seen.
The menu button also didn't work. I tried to again open the app, but again I got a black screen (the same state just got restored). So then I had to press the home button and force stop the app and then start it.
This behaviour is pretty arbitrary. I tried to reproduce it, but it's not something that happens all the time.
But, it does happen sometimes out of the blue.
What could be the reason for this? How can I prevent this?

Sounds related to this:
http://code.google.com/p/codenameone/issues/detail?id=154&can=1&q=wake
I'm guessing you are talking about an Android device right?
The application keeps running when suspended on an Android device, if something happened while the application was suspended it might fail on wakeup. If you can reproduce this file a bug, with the way to reproduce it (including code).
You can use the crash reporting system for paying subscribers (see the developer guide).
You can also install the Android SDK and use DDMS to inspect the device and see what fails (ideally with a debug build).

Related

How can I keep sound playing on my guitar tuner site the way Fender does on their site?

EDIT: Quickly gonna mention that in mobile, the phone cannot be on vibrate/silent mode or else the sounds won't play for whatever reason.
I created a tune-by-ear guitar tuner using React and Howler.js and so far everything works great on Desktop.
It currently lives here: https://rickyd-dev.github.io/sonus_app/
My source code: Sonus Repository
When testing my site on mobile, upon loading the page, the sounds work great. You can tap on the strings and the sounds turn on no problem.
Now, if I were to leave my phone's browser to go into a different app like Twitter for a little bit and then if I come back to my browser with my tuner site still on there, the sounds no longer turn on upon tapping on the strings. I have to do a manual refresh of the page in order for the sounds to play normally again.
I have tried many things like testing the Howler.ctx.state, unloading my sounds and then immediately having them reloaded, and nothing seems to work when it comes to this issue. They all play initially then after leaving and coming back the sounds stop.
I tested the Fender website's guitar tuner (Fender's online tuner), and they do not have this issue. I can load up the site, play sounds, leave the browser to browse reddit for a minute, come back and the sounds STILL play no problem.
I tried looking at their source code and I have also tried debugging by connecting my phone to the computer and testing different things from the mobile browser but I'm not having any luck finding what Fender is doing different.
Does anyone know how they're accomplishing this? That is the ONLY issue that I'm having with this and I have not found a way to tap into the problem. I just want my sounds to play even after a user comes back from another app without having to manually refresh.

Avoid app from closing on app switching

Is it possible to prevent my app from closing. I have a performance problem on some Android devices whenever the app is switched from or the phone screen goes off. One solution I came up with is to keep the app open in the background.
How may I achieve this?
Thanks!
It seems that you expect to have control over background execution of apps. There is no multi-tasking on mobile OS's despite vendor claims to the contrary.
If you have an app running in the background in iOS/Android taking up battery (network is battery intensive) it will be killed. Both OS's have options for specifically tailored background operations with quite a few stipulations involved and neither one is trivial. These are discussed in the developer guide.

Mobile Safari IOS 6 Take a picture

I'm looking into the file upload on IOS6 and know that this is possible with the usual link:
<input type="file" accept="image/*" capture="camera">
Altho, the most tutorials and issues I can find are mostly about the upload function. In my case I need to be able to take a picture inside mobile safari with the build-in camera.
I have set up a page to test this (no code, only the link I posted above), and when I take a picture the app (camera app) crashes without actually saving my picture. Is this normal behaviour? Do I need to add some code to upload the picture first? Altho this last thing doesn't make sence to me, since you need to add an already saved picture to a file upload link.
Any help in this would be greatly appreciated :)
You should not need anything more in the code to avoid crash. It should work the same as choosing a picture from the library. I have tested this on an iPhone 4S with iOS7 and my Safari crashes too. It does not crash every time if I take a picture with the front facing camera (smaller picture?). It also works if I only load the picture from the photo library.
This is a bug in iOS I think. I managed to go around it by restarting my phone. Sadly there is not much we can do on the web side of things, except inform the user that the feature may be buggy.
Probably the best recommendation, until Apple provides a fix in a future update, would be to caution your user to close down the rest of their Safari tabs. (This lowers the memory usage and prevents Safari from crashing when doing the 'Take Photo' path through file upload).

Silverlight 4 Out-Of-Browser issues: app displays blank (white) screen, no exceptions thrown, no breakpoints hit

I'm having issues with Silverlight 4 Out-Of-Browser, as specified in the title.
What I did:
Update project settings to enable Out-Of-Browser. This enabled OOB, but when I ran the app in this way it just displayed a white screen.
What I have done to try to fix this:
All references to the System.Windows.Browser.HtmlPage (to avoid DOM interaction) have been removed as per various sources including this SO question and this blog post.
Remove any references to SizeChangedEventHandler as per this SO question.
Clean projects/solution, including ideas such as deleting *.suo files as per this blog post
Uninstalling the installed OOB app, reinstalling
Also:
As commented on by "kobruleht" here, attempting to attach the debugger does not appear to work. Visual Studio (2010, SP1) reports that it is attached without help from me, but breakpoints are not being hit.
And so:
Can anyone advise on other courses of action? At the very least I'd like to be able to step through and hit breakpoints (or even break on Exceptions!)
OK, I have a resolution.
In AppManifest.xml I specified assemblies to be loaded, one of these was not loading correctly, which meant that App.xaml.cs->App()was never reached. The problem is difficult to diagnose because the program runs, with no errors or exceptions, but then displays a white screen - quite misleading.
For anyone experiencing the same problem, the simplest debugging steps to take in this case is to run the app in in-browser mode, copy the results from the Output window, then compare the results from the Output window when you try to run in OOB mode. Any discrepancies will give a good hint to the problem.
I should also mention, that I have not had trouble with SizeChangedEventHandler as mentioned above.

wpf app appears to be blocking extended screen functionality on hp laptop

I ran into a strange issue where "fn_key -- F4" combination on my hp laptop to extend the screen would stop working once I have a wpf application running. This happens even when I create an empty app -- as soon as I run it, I can't extend my desktop to a second monitor.
Thanks!
Sounds like an issue with your video driver. What kind of video card is it? Are you running the latest drivers from the vendor?
The problem was a driver issue (as Drew mentioned above).
To diagnose an issue like this, please follow the instructions from the MSDN article (http://msdn.microsoft.com/en-us/library/aa970912.aspx) on how to disable hardware acceleration and render everything in software.
Provided your issue is similar to what I have experienced, you will be able to single out the problem by adding the necessary registry key from the article.

Resources