how should the client be notified that the master is offline. And how to integrate the video call UI similar to Whatsapp. Can anyone suggest the best solution?
that will be a part of your app logic. there are a few ways to implement this but one way to do it is to see if the particular user is running the app on foreground and log that as a flag in your database.
For example here it is using Firebase:
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.
// user is offline
let ref = Database.database().reference.child("isOnline").child(user)
ref.setValue(false) // NO
}
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.
let ref = Database.database().reference.child("isOnline").child(user)
ref.setValue(true) // YES
}
For the video call UI you can actually easily customize that using one of included UI in the Agora.io demo apps
Related
When I am running my application on Android device (virtual device) It connects using WebSocket. It's normal flow and there is no question here. When I am using the virtual device for developing I use "Reload" all the time (sure). Can I intercept the reloading process for disconnecting the WS connect? If I do not it manually that my backend won't get relevant event.
You can try to emit the disconnect message in the componentWillUnmount() function. It is bad to use it in a normal app flow (in a back button for example) as it is normally an async function and it is not a good approach to call async functions in the componentWillUnmount(), but in cases that you will only handle the "quit" (reload in your case) I think that this solution can help.
I am developing an App Lock app. Here whenever an application is launched by user
i want a callback in my app regarding which app is launched. Based on some predefined settings i want to show lock screen.
I don't know which API i should use. Whats the in "TI ZEN" using which i can
monitor the app launch.Basically i need to know which application is in foreground.
Using the existing API i have a list of applications installed but need to monitor them.
function onError(err) {
console.log('Error occurred : ' + err.message);
}
function onsuccess(applications) {
var appInfo;
for (var i = 0; i < applications.length; i++) {
appInfo = applications[i];
console.log('Application ID: ' + appInfo.id);
console.log('Icon Path: ' + appInfo.iconPath);
console.log('Name: ' + appInfo.name);
console.log('Version: ' + appInfo.version);
console.log('Show: ' + appInfo.show);
}
}
tizen.application.getAppsInfo(onsuccess, onError);
My Answer is a bit late, but in case you still need it -
Native API
I cant tell what version of Tizen you are using, but for Tizen 3.0, you can get callbacks for whenever an app in launched using the Application Manager API (native API).
Specifically, the function app_manager_set_app_context_event_cb will give you callbacks for when an app is launched or terminated.
Web API
Currently the Javascript API does not have the corresponding function.
Ideally, you need to create a hybrid application and call the above mentioned native API - its not too difficult.
If, however, you want to stick to JavaScript, you can keep calling the function tizen.application.getAppsContext() to monitor which apps are currently running. You won't get a callback when an app launches, but you can poll the above method once every half second to check the currently running apps and kill the appp if you want it locked.
Note that polling too often might affect device performance.
You have to use Tizen Background Service application as your app have to always check which app is coming to foreground.
And for detecting app launching, you may use Tizen App Control API.
I have a custom url scheme working well, but there is one small behaviour I am hoping to change... Currently the inbound url is captured and processed in the following code (so, all good here):
- (void) handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
//I parse and deal with the url here//
}
Is it possible to avoid my app becoming the frontmost application? Whenever the url is received, my app is open already, as I initiated the communication from this app, and are merely listening for the reply. However, sometimes the call is made via an NSTimer so my app may or may not be the frontmost app. I don't want to disrupt the workflow if I am currently say browsing pages in Safari by having my app take the focus from Safari. I hope this makes sense.
Is this possible?
For anyone who's interested i instead set up a group container. I save my payload to the group defaults and then send an NSDistributedNotification from my helper app. The main app gets the notification, and reads the payload data from group defaults.
Such a workaround... but its necessary as both the main and helper apps are sandboxed.
I also discovered that KVO on group defaults doesn't work in the sandbox, and neither does sending a userDictionary in the NSDistributedNOtification.
:(
I have had to write sooo much extra code to make my app play nicely in the sandbox.
I have implemented interactive notification using two actions. When app is not running, and i get 4-5 notifications on lock screen, then if I submit any one action, it clears all notifications automatically, this should not be done. I have just called one webservice on that action. Not clearing all notifications manually, still having same issue.
Video Link https://www.dropbox.com/s/fszdsgnrn7rfb2h/Voicee_issue.MOV?dl=0
You can find my code here :
https://www.dropbox.com/s/5gp5tzcryhlwtyk/appdelegate.rtf?dl=0
When a user first opens my app, I need to download and install some content from a server before they can begin using the app. The problem is that this takes around 5 minutes on wifi, during which time the app goes into the background and the download is suspended.
Is there any way to either:
prevent an iOS app from entering the background whilst I perform my download
or continue peforming the task in the background (i.e. perform the task irrespective of whether the app is in the foreground or background)
Thanks
It really doesn't matter, if the user presses the home button it will go to background. Although you can do two things to mitigate the problem:
Use beginBackgroundTaskWithExpirationHandler, to give you a bit more time to download. Which you can read here.
Don't allow the device to become iddle, with [UIApplication sharedApplication].idleTimerDisabled = YES;. You can read more about that here.
Either way, the best thing you can do is to tell the user, that is an important download and he shouldn't quit the application.
Can't you include some or all of the content in your app bundle instead, and just download changes on first run?
I can't imagine this is a good first user experience, and it may not pass App Store review like this.
The only third party apps that are allowed to download in the background are newsstand apps loading issue content, and Apple are pretty strict about what they allow as newsstand apps.
You can't do what you want, in this situation. One way, and I think the best and only, is to resume your download when you app becomes active (returns to foreground state). Also, don't forget to register for connectivity notifications (Reachability class can be used for this purpose from this Apple sample app http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html). Good Luck!