Expo : Background and Closed Application - expo

To run a function in background in Expo is TaskManager , but work only if app is in FOREGROUND.
How to run a function in background (With App in background ) AND app closed in Expo ?
Example : an easy timer clock ...every second run a function
Thanks

Related

The equivalent of wxYield in Cocoa [duplicate]

This question already has answers here:
How do I update a progress bar in Cocoa during a long running loop?
(4 answers)
Closed 1 year ago.
I'm new to MacOS programming. I'm using Objective-C with XIB interfaces to develop Mac Apps.
I'm making an app that zips and unzips files/folders. I've also implemented a progress bar to show the progress of the task.
But, when the user drops a big file to compress the app freezes, the progress window never gets displayed but the logs are working fine though.
I remember when I was using wxWidgets, in a case like that I'd have to use wxYield() to process the events and update the ui and everything would be fine.
So, what's the way to do this thing on Cocoa?
I worked it using #Willeke's suggestions.
I'm executing the zip_close function on a different thread letting the main one handle the UI updates & events.
Also when the progress callback gets emitted, I'm updating the UI by accessing the main thread (making changes to the UI from another thread will give warnings).
Thank you both #Igor and #Willeke for helping out!

Getting GPS data in background mode on iOS with Qt app

Location updates stops being delivered to application in background after about a 20 minutes. Application is not closed because when I click on app icon it is brought back from background in state I left it and then updates starts comming again. I can also see that in top right corner of task bar there is little arrow when it is displayed I got the updates, when it disappears I'm not receiving updates. I'm getting GPS data every 5 seconds, keep it in some queue and every minute I connect to my server via tcp socket and send these updates. When top right arrow disappears my app no longer connects to the server (and it should even with empty data) so I assume that app is in some suspend mode.
I have written app in Qt/QML and then converted the project to XCode. I have checked "Background Modes" (Location updates, Background fetch) in Capabilities. I have in plist file UIBackgroundModes fetch,location. I have also NSLocationWhenInUse NSLocationAlways and NSLocationAlwaysAndWhenInUse UsageDescription And App in system checking has
settings->myapp->location->Always
Maybe the problem is that app is suspended or put to sleep. In some other project I have used some code to prevent screen fading with some simple code:
void IosLockHelper::setTimerDisabled() {
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
}
Is this this case? But I don't want to have screen turned on all time.
It should continue sending gps location to my server in some intervals it can be 1,5 minutes.
I'm testing on iOS 12.3.1 and with Qt 5.12.3
Thanks in advance
Marek

Force to start App after came back from background. Swift 3 [duplicate]

This question already has answers here:
Exit application in iOS 4.0
(11 answers)
Closed 6 years ago.
I have some problems with my interface when I open my app, go to background and finally return to foreground. So I want to force my app to start the app always, when I came back from background.
I saw that Clash Royale game is working like that.
I am developing with swift 3
I don't know exactly what your Home Page looks like that you want to load up after returning from the background but you should be able to use the functions in the AppDelegate to be able to set values and load up Scenes or Views as needed when returning from the background state or to be able to set the desired view as the app gets closed down.
Here is a list of the functions that are already built into the AppDelegate.
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

CCRepeatAction causing Win32 App to crash on closing

Could someone help me figure out how to safely stop all actions when closing a Win32 cocos2dx app that is running CCRepeatAction. I have tried adding sprite->stopAllActions(); in the Destructor, OnExit() and in the update(float delta); methods but still app crashes when I click on the 'X' button of my running Win32 Cocos2dx app.
I am not retaining the CCRepeatAction and I have also tried just letting Cocos2D-X stop the running action when it does its cleanup, but it seems like if a CCAction is running while app is closed then app crashes. So my assumption is that the action has to be stopped when closing the Win32 App.
The repeat forever action is running on my idle state. It is a simple fadeIn/fadeOut CCAction. Here is the code for my Idle state animation. I am not retaining it so not sure how to stop the animation and close the app without crashing it.
if ( idleAnim == true )
{
this->getSprite()->stopAllActions();
CCSequence *actions = CCSequence::create(CCFadeIn::create(0.5f), CCFadeOut::create(0.5f),NULL);
CCRepeatForever *repeat = CCRepeatForever::create(actions);
this->getSprite()->runAction(repeat);
idleAnim = false;
}

xcode 4.5 Application windows are expected to have a root view controller at the end of application launch

I just started developing a game for my new iphone 5 but every time I build it to my device I get this warning in the console.
Application windows are expected to have a root view controller at the end of application launch
I searched the web for a fix but everything I was finding said to put this line of code:
window.rootViewController = rootViewController;
In this method:
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
But the problem with this is that line of code had to be commented out in cocos2d because it was causing the application to start up in portrait mode no matter what orientation was selected. So does anyone know of a fix for this?
This may not be relevant at all for solving your problem but I struggled with the same error a while ago when I began using iOS 6.0.
I was using the method - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation to do some initializations to my views at launch, but then I found out that it had been deprecated in iOS 6.0 (as mentioned here) resulting in the method never being called as before.
If that's your case you could simply implement the following:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[self shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
}