Broadcasting Android application using Opentok SDK - android

Im working on an android application where multiple user subscribe to my stream published from android device. What i want to pull off is, when i click the video of a certain subscriber, all the subscriber(user) will then subscribe to his/her stream rather than mine.
if there is any article or code to suggest me, please do so.

I don't have a sample to point to but I can tell you how I would solve this.
You will need to communicate to everyone in the Session which stream to subscribe to. You can use the signal API in opentok to do this by passing a streamId along. Then when each participant receives that signal they can lookup the corresponding stream and subscribe to it. You will need to make sure that every time a new person joins you also send them a signal saying which stream to subscribe to. You can do this by listening for the connectionCreated event.
If only one participant is allowed to tell everyone who to subscribe to then you might want to have a look at the connection data property of tokens. Then you can add eg. 'admin' as the connection data and then when you receive the signals make sure that they are coming from someone that has 'admin' as their connection data.

Related

How can we know if we have received any subscription request in openfire xmpp smack library

I am beginner in xmpp openfire.I am creating an android chat application.
I know how we can send and accept subscription request in openfire.But how can we know if user has received any subscription request from other user in android?
I have searched around the internet for this but didn't find any satisfactory answer.
Do we receive any automatic notification upon request or we have to call any function.
Please help me.I will be highly obliged for your precious answer
First, you need to understand few things in smack. e.g you need to add a packet listner so that you have access to all the packets. without registering your listner you won't get any packet but smack will still get those and even print those in logcat. So register your listner and set the debugger = true in smack configuration so it prints all the packets in logcat and you can understand better.
Secondly, Yes, B will get the packet ("notification") that A has added you ,now base on Roster subscription settings, decision will be taken.
Thirdly, as per my knowledge, you will receive these subscription/presence packets whenever B gets online. so you have that place to take your action.
I would really recommend you to check the official docs here:
Smack Docs

Telephone with OpenTok

We are developing a VoIP app and we want to switch to the Tokbox library.
Ours is like a telephone app just like Viber but for a specific audience. We need the app to behave like a telephone app. The user makes the call, the receiver hears the phone ringing, picks up the call and hangs it up when done talking. I could find a lot of resources on Tokbox online (for Android and iOS) but I couldn't find much info on a telephone with the library. Can anyone point me to the right direction or explain things a little bit.
Thanks in advance.
To implement a mobile telephony app (like Viber) where user A calls user B you need a couple of extra pieces in addition to TokBox platform.
First you need to make use of standard Apple&Google push notifications to initiate the call to B. For example you can use Google's service [1]. Typically A will send a HTTP request to your server to initiate the call to B and your server will use Google API to send the push notification to B.
At the same time your server should generate a TokBox sessionId for this call and send that sessionId and a token back to user A. User A can use them to connect to the TokBox session and start publishing while waiting for B to join it.
When B receives the notification then you can alert the user (ringing tone) and present any UI you want to him. When B accepts the call you can make another HTTP request to your server to get the sessionId and token for the call (that sessionnId and token could also come in the initial push notification) and join it.
At that point you have both users (A and B) connected to the same TokBox session, publishing audio&video and subscribing to the other stream, so you have a bidirectional audio+video call.
[1] https://firebase.google.com/docs/cloud-messaging/

Xamarin crossplatform, how to reliably send events from server to client

I'm creating video chat (like skype, but for a specific type of companies) apps for Android and iOS using Xamarin. I'm wondering what the best approach is to handle the server to client communication, specifically when a call is coming, how do I fast and reliably contact the receiver ie client phone?
I want to be able to contact my App even if it is closed
I need to know if the message have gone through
It has to be fast, preferably under 1 second
I've read about push notification and they can wake my app, but they are slow and no guarantee they will get through.
I've been looking into SignalR which are fast and reliable, but I can't quite see how to open my app.
Currently I'm thinking about setting a status wether or not the app is open. If it's open I'll use signalR else the caller will be asked if he wants to notify the receiver about the incoming call. Does anyone have better idea?

Can Android wearable send event to the phone and call 3rd party Services?

I'm new to wearable development, it's quite standard that wearable only uses GoogleAPIs. But is it possible to call a background service from the phone and send the results back ?
this is my thoughts:
Wearable send an event to the phone via MessageAPI, eg: request a particular news feed.
The phone wakes up it's service when it receives the event.
services does the background task and post the results back to wearable.
I haven't try this approach yet, just want to gather more opinions first. Thanks!
Yes, this is a completely valid approach. I understand, that you are sending the data to the phone, because you need some resource (most likely internet connection) that is not available to you on the wearable?

Triggering Intents remotely in Android

I am writing an Android app that talks to a server. The server has information that is updated irregularly, and the app must be informed of each update. My current solution is to have the app query the server at regular intervals to see if the information has been updated.
Is there any way to have the server initiate the interaction (say, only when the information is actually updated)? I have heard about "Remote Intents" which simulate this behavior, but I have not been able to find any information on them. Does anyone have any advice on how to make this work?
Read up on Cloud To Device Messaging. This is designed to do exactly what you're looking for.
You could have the server send out an SMS message, and the application checks for a certain pattern (perhaps starts with something known). The data is extracted from the message and the notification is raised.
This question deals with how to analyze incoming messages:
How to analyze incoming SMS on Android?

Categories

Resources