sendReliableMessage to self? Google Play Game Services - Android - android

I am trying to create a real-time multiplayer game using Google Play Game Services. I am trying to set one player as host. Everyone will send their commands to the host (via sendReliableMessage), and they will receive a response of what to render.
However, I am trying to have the host send himself a message (before acting) in order to be in sync with everyone else, but the onRealTimeMessageReceived is not firing for the host when the host himself sends out the message.
Is it possible for the host to send a message to himself? If not, how would I go about this? The Google tutorial even says I should have a host player.

You cannot do this using the sendReliableMessage() function in RealTimeMultiplayer class. As written here, the function throws an IllegalArgumentException if recipientParticipantId is not a valid participant or belongs to the current player.
The thing that you need to do is to forward all received messages (sent by others) to a common class/method etc (depending on your design/wish) to keep clients updated and keep your game logic running and call the class/method manually for the host.

Related

RemotePlaybackClient - Resume session

I am trying to implement a sample application using the Media Router API and the RemotePlaybackClient class. I do not want to implement Google Cast SDK (simply because I want to support other remote devices than Google Cast ones).
Everything works quite fine until I want to retrieve the session currently playing on the remote device.
By that I mean that for example, I have a mobile device A casting to a specific remote player (RM) with my sender app. If I kill my app, then launch it again, how can I retrieve the info of the current playback session on the remote device ? The same situation occurs if I try to select the media route from another mobile device B with the same application.
Also, how should this be implemented on MediaRouterProvider side ?
When you use Netflix for example, it is able to retrieve info of the currently playing session, up to the item currently playing.
There is not so much documentation on the subject, and the samples provided by Google do not seem to implement this feature.
Fling can also be implemented using RemotePlaybackClient, and specifies at the end of their online doc that some callbacks are just not called at all by Cast devices (#CommonsWare also noted that).
Found this subject, but no answer to this specific situation has been provided.
Any idea ?
Thanks !
Edit: Basically, I am trying to join the current session from another device / instance (feature is available for the Cast SDK). How can I do that using the media router provider ? There is no application id using only the media router...
The feature you are talking about (i.e. joining an on-going session) is a Cast feature and not supported/covered by Media Router. The reason that apps such as Netflix can do that is because they are using the Google Cast SDK.

How to make a phone call without phone app like google hangout?

I'm not going to use Intent to invoke default system Phone App, such as Google Hangout. Can we make a call or receive a income call inside our own app rather than system phone app?
Yes,You can do that with the help of a VOIP account. Try over internet you can find lot of VOIP providers and you just have to create an account and use the given instructions.
Android provides an API that supports the Session Initiation Protocol (SIP). This lets you add SIP-based internet telephony features to your applications. Android includes a full SIP protocol stack and integrated call management services that let applications easily set up outgoing and incoming voice calls, without having to manage sessions, transport-level communication, or audio record or playback directly.
Here are examples of the types of applications that might use the SIP API:
Video conferencing.
Instant messaging
Check this Example or Example 2

Does Google Licence Verification Library run on an Android Wear device?

I have been looking into Google LVL to address stolen apps issues.
The API states the device need to "Run a system image on which the Google Play client application is preinstalled"
This cannot happend on a Wear device, but I am wondering if it can leverage the host phone instance of Google Client.
Has anyone faced this scenario?
You can't leverage the phone instance directly but a common approach at getting anything the phone can provide (network status etc) is to use the messaging api to send a custom message to request the information and get a message from the phone as a response. You could easily add to your wearable listener service on the mobile side to call the licencing and then wrap up a response and send a message to the wearable.
Depending on what your app does I'd try to put this as part of an existing message from mobile to wear to save unnecessary chatter.

Android - Share data between apps over the internet

I want to build a app with sharing option. I mean that users can pass simple data between their contacts, that use the app. And I don't want to use servers of mine.
Is it possible to use existing platforms such as Facebook, Google, or even with android APi only?
If it can be done, how can I do it?
You can try with gcm - Google Cloud Messaging for Android
Nevertheless, for this you will have to use some kind of server to send push messages.
I created the free and Open Source web service cross copy to do file and message transfer between devices via simple RESTful commands:
waiting for messages to appear "on the given codeword" (long polling):
GET http://cross-copy.net/api/any_codeword_you_like
sening a message in body to all waiting clients:
PUT http://cross-copy.net/api/any_codeword_you_like
Both devices must use the same codeword and hence it must be agreed upon (displayed on screen, QR-Code, prediefined, computed by geo location or what ever fits for your application. More infos are available in the readme at GitHub.

What API is used by Google+ Android app?

There is a Google+ mobile application for Android. To receive all the information it must be using some API.
How I can retrieve this information from my phone and see from where this app is getting data? I'd love to access it myself and see how it works.
You are talking about "reverse engineering" a network protocol.
Full sniffing
Get a market enabled emulator: How to install Android Market App on the emulator?
Get a network sniffer: tcpdump, wireshark, ...
Start to sniff what's going over the wire
http://www.thoughtcrime.org/software/sslstrip/ - an ssl stripping proxy
Inject your ca: http://www.mcbsys.com/techblog/2010/12/android-certificates/
This should, in theory, enable you to sniff any https or plain text connection.
Already available APIs
I would not try to hijack the connection. There is already a contacts API, it's called xmpp. You should be able to use the talk integration to pull your friend list.
Future APIs
You may also want to sign up for the upcoming API.
UPDATE
It appears that the Android client uses (at least partially) XMPP. The regular client requires an open XMPP connection and you can see a "RealTimeChat" in your logcat. It looks like the connection is encrypted because you get a "TLS required" message (the client seems to go through the XMPP connection states). I'm not sure if that's used for client based posts or just for server push. You can see the open connections with the help of "netstat". The connection goes away when google plus terminates.
I'd thus expect the API to be really open once released (or rev.eng).
UPDATE 2 (06. Jul. 2011)
Hangout is build on XMPP/MUC+JINGLE (muc == multiuser chat, jingle is roughly a SIP alternative on top of XMPP). And yes, they'll release the the details of it :-)
UPDATE 3 (06. Jul. 2011)
Multiple XMPP components for gtalk/gplus have been revealed by reading the JS code. It also emphasizes that they have build a great deal of features on XMPP.
They haven't launched the API yet. If there is something you want to build on Google+, they encourage you to signup here: https://services.google.com/fb/forms/plusdevelopers/
The API hasn't been released yet. Heck, the product hasn't even been released yet. Thats like developing a video game for playstation 5.
Yes it is. Its coming "soon" read :: http://www.webpronews.com/api-coming-soon-for-google-plus-2011-07

Categories

Resources