I have a main app with a bundled helper app within. The helper app is a necessity for the main app to function correctly. As of right now, I have the main app launch the helper app on launch, and have the main app send a notification telling the helper app to terminated through the NSDistributedNotificationCenter on the termination of the main app.
This way works most of the time. However, if the main app is force closed, the helper app remains running (no notification is sent. I am using the AppDelegate's applicationWillTerminate method to send the notification).
Is there a way to make the running of the helper app more reliable? Also, is there a better way to make the communication between the two apps (ie not NSDistributedNotificationCenter; is there away to communicate through app bundles?)?
Thanks!
You could always use a common approach of 'pinging' each other to indicate the app is still alive (also via notifications) like once a minute.
No notification received after some timeout being the helper app's trigger to shut itself down.
Not super-elegant but pragmatic and proven.
Or check the list of processes for the other app still being alive, though the latter sounds more brittle to me.
Related
I want to develop an app which notifies user whether it rains or not when they're out.
For that, I determined to utilize push notification service.
Therefore, I need to execute something in particular time (e.g., sending request to API server) when app is closed.
Are there any modules or packages in react-native?
Thanks in advance!
Pardon me if this question has been asked before, I just couldn't find the answer.
I have an react native application, it has calling feature using .Net Core SignalR (For signalling) and webRTC for actual calling. There are three scenarios out of which my application works fine in two scenarios:
Application is in foreground: For this I simply inform other client that X is calling you (using signals from SignalR).
Application is in background: For this I send push notification to the client which is read by the application (notification listener) which in turns opens up the call accept/decline window.
I am struggling with scenario 3:
Application has been killed (from recent apps etc.) and is now not in background in this scenario I only receive the push notification but call windows doesn't open but if I open up that notification I can see the calling window as intended. I need a solution which will open up the calling window automatically just like it does in scenario 1 & 2. How can I listen to push notifications when the application is dead? So that I can show the call window?
I am looking for a solution that would preferably work both on Android and iOS and I am using FCM Push notifications. I am also open to solutions other than push notifications as long as they work correctly.
For supporting to android and iOS you can use
import messaging from "#react-native-firebase/messaging";
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
// handle your notification message here
}
We're currently testing our existing app against the iOS8 Beta 5.
While testing the new iOS interactive notifications (as implemented in iMessage), when these arrive while focus is on our app, our app is not automatically interrupted. The app continues to run until the player has responded to the notification.
Our app is an action game, so you can see the problem with it continuing to run without user input.
Is there any way we can make our app recognise the incoming notification, and enter a paused state?
I had been expecting iOS8 to handle that gracefully and suspend the app, but it doesn't do this, at least not in Beta 5. So I assume that Apple are expecting developers to implement this themselves on a per-app basis?
I work on application, that uses Remote Notifications, and I am curious about something:
I notice, that Facebook app cleans notifications and application badge, when you read it in browser,even if you killed an app from app switcher.That happens when friend add something in your timeline.
So my question is: How this is done?
My understanding is when Application is killed from App switcher it goes into suspended state and cannot execute code.Is it possible to do this in my app?
As I understand they just are sending push notification with badge number set to 0.
Context
Many native apps have the user authenticate with Facebook, rather than with their own authentication system. This has been problematic for me to write iOS UIAutomation testcases with the Javascript bindings. Our scenario, from the user's perspective, typically looks like this.
Scenario
The user clicks "Connect to Facebook".
The (target) applications moves to the background, and a Safari browser moves into the foreground, so the user can authenticate with oAuth.
The user enters their authentication data and submits.
The Safari browser window moves into the background, and the target application moves back into the foreground.
Problem
Before running tests, Instruments has the user set the "target app" in the top menu bar.
Using the Automation within Instruments proves problematic when the target app moves into the background and the Safari app moves into the foreground (Step #2). At this point, Instruments reports
The target application appears to have died
I thought this would be as simple as merely polling/testing for changes in UIATarget.localTarget().frontMostApp() (or something similar), but does not seem to be the case -- the test run stops executing.
How can I use Instruments to successfully test this scenario? Is this a testable scenario with UIAutomation's Javascript bindings?
Alas, this is not possible. Instruments loses it's connection with the app since the app freezes in the background and does not continue. Also, it's not possible to send touch events to Safari because UI Automation doesn't work with apps that you didn't build yourself.
If you're using a pre-built SDK, you're pretty much out of luck. But if you are rolling your own Oauth connection to them, you could present a modal view controller with a webview going to Facebook's Oauth authentication page instead of kicking the user all the way out to mobile Safari.
That way, the application never exits. You can then figure out the events to send to the webview and try testing this from there.