sceneDidEnterBackground( and applicationDidEnterBackground( not getting called when the app is launched in the background - core-location

I have a location service running with background mode capabilities, and according to apple docs the app will call sceneDidEnterBackground() or applicationDidEnterBackground() if the app was launched in the background due to location event or if the app was suspended and received a location event. I am not witnessing this happening.
These methods are only called when the user moves away from the apps.
I am more concerned with the scenario where the app is suspended and gets move to background due to a location event as that is my only point of connection to execute code.

Related

How can I get Flutter to handle true background processing?

My lead developer chatted with me about an issue we are running into with Flutter. We are building a mobile app and now we have hit a potential issue regarding threading. He said that Flutter by design is normally single thread. He thinks he can get more than one thread to work, but he can't wrap his head around how to get the threads to communicate with each other.
What we need is true background processing where something can be totally handed off to a separate thread to function then no matter where the app is at something can receive a notification from that thread to be able to correctly refresh the UI state.
A simplified example of this is:
User uploads an image
Image gets processed in a different thread
Badge shows up saying something like "image is processing"
Image processing thread gets completed
Badge goes away
The badge / UI thread would have to be send something from the image processing thread in this example. How could we tackle this with Flutter?
You can use isolates with send port and receive port to communicate between the Ui thread and the isolate.
Flutter Isolate Example
Here is a greater plugin to help you use plugins in an isolate flutter_isolate: ^2.0.0

Google App Engine - nodejs application goes down over night

Hi I am using google app engine to host a single instance nodejs application. The application works fine and my scripts are showing no errors in the logs. The application is currently just in testing and is not getting used over night, however often I come to work the next day and the server is just returning internal server errors. No errors are shown in my application log other then the 502 errors which i get when trying to access the next day. I see like 100s of calls for /_ah/_background/ overnight some appear to have timed out. At this point I must restart my instance for the app to continue to function.
I am completely stumped.. Because my app using web-sockets I must use manual scaling and a single instance. Would appreciate any help / suggestions.
I would venture a gues that you have a deferred task stuck running. Tasks that run in the taskqueue api are set by default to continuously retry. You can visit the taskqueue api TaskQueue API
To get the tasks to stop running right now visit the Google Cloud Console
select your project. Then select App Engine. Then select Task queues. Click on the task that is running (probably default). There should be a option to Pause the queue. This should prevent the 500 errors from occurring but will not fix the reason the task is failing.

How to prevent node.js process from restarting on Azure topology change

I have a node.js service running in Azure as worker role. By default the process is restarted every time there is a topology change, e.g. instance count is increased via Azure portal. How can I prevent this restart?
MSDN documentation pointed to handling Azure's "Changing" event. Azure Node SDK's support for cancelling was added here and here.
The code to use the API would be something like
azure.RoleEnvironment.on(ServiceRuntimeConstants.CHANGING, function (changes) {
changes.cancel();
});
From logs I know the handler is called, but restarts still took place afterwards. Am I using the API incorrectly or is this the wrong approach?
When using the Role Changing event in .NET when you cancel the event you are actually asking the system to restart. The docs for the Role Changing event on MSDN say this:
By using the Cancel property, you can ensure that the instance
proceeds through an orderly shutdown sequence and is taken offline
before the configuration change is applied. During the shutdown
process, Windows Azure raises the Stopping event, and then runs any
code in the OnStop method.
The idea of the Role Changing event is that if you can modify the configuration at runtime without requiring a restart you do so. By cancelling the changing event you are in essence saying, "I can't change this at runtime, so restart gracefully and pick up the new changes then."
I've not tried this with Node, but try not cancelling it.

My cocoa app logs some "[Switching to process XXXX thread 0xXXXX]"

when I test my app in cocoa I can read some "[Switching to process XXXX thread 0xXXXX]" that I'm not understanding...
When app creates a thread?
For example, when I mouseover some main menu items, I get [Switching to process XXXX thread 0xXXXX]
Why?
Apple can reject my application of app store for this reason?
Thx!
It's neither an error, nor a problem. It's a normal part of an application running in the debugger.
Do the menu items have a custom image, or use any animation effects?
The messages in the debugger are only showing that the application has switched to another thread to handle the processing and unless I am missing something, I don't think there is any need to worry about them.
Our app, which has been in the app store for a few months uses images and animation on certain sections and gets process switching notifications in the debugger and has never been rejected for that fact.

what is the best approach for starting a background thread as part of a pollingDuplex scenerio

The client application will register requests to monitor events on the server. The Client's call back is added to a dictionary (and refreshed by the client on a regular interval)
The server will monitor an MSMQ private queue for events, and when an event that a subscriber has registered for occurs the server will call the client(s).
This hinges on starting a background thread that can wait on the MSMQ and then call the registered client apps. What is the best way to start up this background thread? My first through was to simply launch it in the Application_Start event of the global.asax file. This has a number of pitfalls, as discussed in Chris Anderson's answer to this SO question Furthermore, this the pitfall of the thread lingering around on the developer machine after they stop debugging the app.
Perhaps there's a completely different approach that is warranted, such suggestions are also welcome.
Why not start your background thread when the first client registers, and signal it to stop when the last client unregisters or times out?

Resources