Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / GetBroadcastMessage() Issue on 4.x devices

Author
Message
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 16th Aug 2012 23:12
Not sure if anyone has come across this or how many have the ability to test this, but I am using two Android devices ( 2.3.x and a 4.x ) to test this code.

Summary of the code in question:


The documentation was a little unclear so this code is just meant to confirm that when hosting and using broadcast the network name that is used when hosting is actually available in the broadcast to use to join.

So while I was testing, I noticed that if I hosted on my 2.3.x device my 4.x device saw the broadcast and reported a game name, however, when my 4.x hosted, my 2.3.x device doesn\'t ever receive a network message on the broadcast listener.

Ideas? Bug?
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 16th Aug 2012 23:14
Also, I don't know if it makes a difference, but the PC doesn't receive broadcasts, either ( nor does it send it like the 4.x device ).
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 16th Aug 2012 23:54
Got a hold of another 2.3.x device and it works flawlessly with the other 2.3.x so I think it has something to do with 4.x

Maybe it is failing to broadcast anything. Might have something to do with its new Wi-Fi Connect feature.

@Paul, I know you just got a new 4.x device, maybe you can take a look?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Aug 2012 02:59
Unfortunately we have discovered that some Android devices cannot receive broadcast packets, apparently due to power saving but don't quote me on that. We had to use a trick to broadcast apps to these devices by having the device instead broadcast its presence to the network, then the compiler (running on a PC that will always accept broadcast packets) picks up these devices and connects directly to them.

To get communication going between two devices that can't receive broadcasts would require having the user type in the IP address of the host to connect directly to it. Or having a third party such as a PC negotiate the link.
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 17th Aug 2012 03:02
In that case, it's not a problem to do the IP workaround. However, what would be your best advice for acquiring the device's own IP address ( both internal for LAN games and external for internet )?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Aug 2012 04:15
For LAN the IP will be in the WiFi settings of the device. It would be nice to have a command that returned this within AppGameKit, I'll note this for the future. For external IP your best bet is probably setting up a script on a web server somewhere that returns the IP address of any device that calls it, in PHP it would be

which you can call with the AppGameKit HTTP commands.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 17th Aug 2012 11:29
erm if you cannot connect to the device to get its IP using AppGameKit how is writing an app going to help?

My solution to that question... setup the APK process and create an APK file for that app, send it to the device, say DropBox or USB and install using Allow Unknown Sources and there you go you can now get the IP address by using your own App without using some dodgy app downloaded from the play store... (this will also help you setup your publishing environment in advance if you have not already got it setup )

If I was totally stupid sounding here just ignore me

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Aug 2012 23:53
Quote: " install using Allow Unknown Sources"


You can't expect your users to do this, in fact 95% won't do it

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 20th Aug 2012 00:25
Quote: "You can't expect your users to do this, in fact 95% won't do it"


I think I might have been half asleep and only looked at the word broadcast >.< I thought he could not use app broadcast from AppGameKit

anyhoo

Login to post a reply

Server time is: 2024-11-23 15:15:42
Your offset time is: 2024-11-23 15:15:42