Whats the difference between OnApplicationFocus() and OnApplicationPause()? - mobile

Speaking of mobile devices, whats the difference between those two methods? If I press the home key both are called. Is there any situation when one is called and not the other?

Since this UnityAnswer is one of the first (if not the first) to be
returned on a search for OnApplicationFocus/Pause & iOS, an important
update in Unity 4.6.1 has changed the behavior for iOS.
As of 4.6.1, both OnApplicationFocus and OnApplicationPause will be
called in iOS.
The order is :
App initially starts:
OnApplicationFocus(true) is called
App is soft closed:
OnApplicationFocus(false) is called
OnApplicationPause(true) is called
App is brought forward after soft closing:
OnApplicationPause(false) is called
OnApplicationFocus(true) is called
Hope that helps
http://answers.unity.com/answers/970958/view.html

Related

CodeceptJS/Puppeteer only sees elements during paused sessions

I'm having a very frustrating problem with testing a React app using CodeceptJS and puppeteer - it only finds elements with a custom locator only when in paused mode.
My custom locator is data-test-id. I'm targeting elements using I.seeElement("$id-of-element-here") and I.seeNumberOfElements("$test-id", X).
This works perfectly when my tests are paused and I'm manually moving onto each step of the test, but does not work when the tests are executing from start to finish - targeted elements are simply not found.
Sometimes I can counter this with I.wait(X) or I.refreshPage() but I'm now running into a case where none of this helps.
I do see the data-test-id attributes in the HTML using both Chrome's and Chromium's dev tools. There are no typos either.
There's not much point in showing examples of targeted elements, as the problem seems to happen at random, I haven't been able to see any pattern of where/when this happens.
These are the settings of the custom locator plugin, in codecept.conf.js:
plugins{
...
customLocator: {
enabled: true,
attribute: 'data-test-id',
},
...
}
Any help will be appreciated! :)
May waitForNavigation is a way to go?
https://codecept.io/helpers/Puppeteer/#configuration
https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitfornavigationoptions
Solution:
I was running the assertions in question in a rather big within block (link), so I was ending up looking for something within an element that was no longer on the page.
It appears that during a pause(), you can find and operate on elements that are visible at the moment and the within blocks don't matter.
That's the only way I can explain why, in this situation, an element can be detected during a pause but not during the actual execution of the test from start to finish.
As soon as I moved the assertions out of the within block, everything was normal and behaved as expected.
Apologies for the confusion - learning every day... :)

iOS11 MPMusicPlayerController's nowPlayingItem method stuck

Did anybody experience MPMusicPlayerController's nowPlayingItem method being stuck after iOS 11 upgrade? It gets SIGSTOP eventually after couple of seconds.
Yes. When my MPMusicPlayerControllerNowPlayingItemDidChangeNotification is called, the MPMusicPlayerController.nowPlayingItem is usually nil-- but only when playing a song from Apple Music (even if the song has already been downloaded to the device).
My workaround is to manually call my MPMusicPlayerControllerNowPlayingItemDidChangeNotification method again after one second. By then, the MPMusicPlayerController.nowPlayingItem is usually non-nil.
Of course, this makes my UI look quite unresponsive and sluggish.

Attempt to invoke virtual method 'void android.graphics.Point.setAntiAlias(boolean)' on a null object reference

Within a Codename1 app, I'm getting a CrashReport: java.lang.NullPointException: Attempt to invoke virtual method 'void android.graphics.Point.setAntiAlias(boolean)' on a null object reference. This seems to occur after I invoke a "show()" on the main form of my application.
Note that the code runs fine in the simulator, but consistently gets this error prior to doing the "show()" on Android.
Interestingly, if I put a Dialog like this:
Dialog.show("Wait a sec", "Showing interrupt point", "OK", null);
before the .show(), and then click "OK", then everything runs well with no exceptions at all.
But a sleep(5000) instead of the Dialog does not help - still get the exception. So it at least seems like its not a race condition.
I have try-catches wrapped around all of the potentially offending code, and have NOT been able to isolate this. It always gets caught by the CrashReport, and only when running on the Android device.
Any ideas?
The symptoms to this one are pretty strange (i.e. workaround with a Dialog), and it would be interesting to have an explanation. However, since deprecated cn1 (Map) code has seemingly been implicated, I'm going to let this one go and replace this code with the latest Google native maps code. If it recurs, I will post another question then.

What is 'vending' in React Native?

After reading through some of the React Native docs I was left wondering where the term 'vend' comes from. Can anyone elucidate the etymology of 'vend' or whether the word could benefit from a more expansive definition than the procedural one given in the docs (this one is from the React Native iOS docs):
Vending a view is simple:
Create the basic subclass.
Add the RCT_EXPORT_MODULE() marker macro.
Implement the -(UIView *)view method
In this case, vend is synonymous with 'serve'. Try replacing each instance of 'vend' with 'serve' and it should make sense to you.
The key is to make the RCTMapManager a delegate for all the views it vends, and...
.
You can see we're setting the manager as the delegate for every view that it vends, then...
.
These subclasses are similar in function to view controllers, but are essentially singletons - only one instance of each is created by the bridge. They vend native views to the RCTUIManager, which...

Implementing Google Analytics 2 in IOS 6

While updating an app to ios 6, I found google analytics also needs update.
Following this method, I discovered it needs a ViewController which extends GAITrackedViewController class
https://developers.google.com/analytics/devguides/collection/ios/v2/
The guide mentions the following code in ViewDidLoad method, whereas I want it in some specific method. It doesn't seems to work. Kindly advise.
self.trackedViewName = #"My App";
Using GAITrackedViewController means giving up control over when [tracker trackView:viewName] gets called. Setting the trackedViewName allows GAITrackedViewController to call [tracker trackView:self.trackedViewName] whenever it wants (presumably in viewDidAppear).
Also, GAITrackedViewController uses a KVO on this property, so view tracking doesn't get turned on until self.trackedViewName = #"view name" is performed.
Calling this in viewDidLoad assures that it's setup correctly by the time the first viewDidAppear gets called.

Resources