Start a new topic

On Nexus S(Android 2.3.6) the screen is blinking :(

On Nexus S(Android 2.3.6) the screen is blinking :(


I am having an issue with Google phone Nexus S. The screen is blinking when architectView starts. 

I am using the latest SDK and same application works stable on HTC and Xperia phone. No bliking effect!  On Google Nexus(Android 2.3.6) though the behaviour is very strange :( When debuging and trying to understand what's going on I see that it jumps from onResume() to onPause() and again and again and again. The call of onResume() to onPause() is caused by LocationUpdates. Maybe this is why it is blinking? Other code that loads data in background gets it's time to execute and works well. On devices like HTC and Xperia screen does not blick. 

Have you experienced this kind of problem before? What could it be?

Thank you very much!
Hi Sergey

When you say 

The call of onResume() to onPause() is caused by LocationUpdates

Do you manually call these life-cycle methods in your location-manager?
You should never call this kind of methods manually since they affect activity and indirectly also the ArchitectView. Please just call the code that is relevant for your locationUpdates and e.g. bundle it in a helper-function you call where necessary.

The fact that it only occurs on one of your devices might be just because this device delivers location updates more frequently.

I hope that solves your issue.

Kind regards,
Andreas, thank you very much for your response!

No, I do not call methods onResume() and onPause() manually. They are called when Activity lifecycle needs them to be called. They are being managed by Android. I do not call them manually. 

I start and stop ArchitectView in ARViewActivity. All methods that have to do with location updates are in MyLocationListener class which is in a separate .java file. 

I instantiate MyLocationListener inside of ARViewActivity and request location updates with an interval of 5 seconds. These could be even 10 secods but not more due to the nature of our application. But delaying location updates does not help. The screen blinks as soon as location update arrives. And this happens only on Nexus S device :(. 

Criteria criteria = new Criteria();
myLocationListener = new MyLocationListener();
String provider = mLocManager.getBestProvider(criteria, true);
mLocManager.requestLocationUpdates(provider, 5000, 0, myLocationListener);

loc = mLocManager.getLastKnownLocation(provider);
if (loc != null) {this.architectView.setLocation((float) (loc.getLatitude()),(float) (loc.getLongitude()), loc.getAccuracy(),loc.getTime());}

Andreas, location listener is a separate class to ARViewActivity. When location update is recieved I call a javascript method I created to update location information in architectView.

architectView.callJavascript("updateCurrentLocation("+ loc.getLatitude() + ", " + loc.getLongitude() + ");");
This works on HTC and Experia devices and the screen blinks on Nexus S. Is the way I request location updates or update architectView wrong and I should correct it? Do you have applications that periodically recieve location updates and update ArchitectView I can download and try on Nexus S device and see if the screen does not blink? 

Thank you Andreas! I hope to hear back for you. Hope you can advise and help me get this fixed. 
Hi again Sergey,

ok, now I got the "big picture" :-)

Have you ever tried what happens when you do not call your manually created updateCurrentLocation in JS? Is screen still blinking?

When you want to get location-updates in your JS please use this approach instead (simply define AR.context.onLocationChanged)

function locationChanged(lat, lon, alt, acc) {
AR.context.onLocationChanged = locationChanged;
(in html)

Wikitude App for Android is based on the ARchitect SDK and updates Location frequently, but (hopfully) does not blink on any devices (You may try e.g. the "Around Me"-World.

Hope that helps.

Kind regards,
Andreas, thank you very much for your response! Please forgive me for this late reply!

I have tried updating location in AR view the way you suggested. It works very well on HTC and Experia. No blinking as expected!  but I cannot try it at the moment on Nexus S :(. Looks like device battery or device itself died and I cannot do anything to make it running again. I will let you know if the screen is still blinking as soon as I find a new Nexus S device to test. 
Login or Signup to post a comment