Thursday, January 31, 2013

Thursday, January 17, 2013

iOS Peer-to-Peer Data Transfer Code Basics (e.g. sharing data among iPads in the same area)

(Disclaimer: These are only notes from research, not implementation.)
Problem:
You and your friends all have iPads and are all in a room, i.e. physically close to each other. You all would like to share some data among yourselves, but not through the cloud where each of you individually uploads then downloads data from.

Solution:
1. The iOS devices need to discover each other, i.e. each iPad in the room needs to know the presence/"name" of all the other iPads in the room.
For this device discovery, you will need to use Bonjour, and Bonjour's link 2.
2. Once the devices know the identity of each other, they will need to communicate through a network, which is a medium for their data transfer. This network can either be Bluetooth or WiFi. Bluetooth is more commonly used, and you can even use it for communications between iOS and Android devices.
But perhaps you want to use both Bluetooth and WiFi. Luckily, GameKit abstracts local network connections. GameKit's GKSession discovers and connects nearby iOS devices using either Bluetooth or WiFi, whichever one works.


Update: I'm told that GKSession also discovers devices.

Links:
Bonjour link 1
Bonjour link 2
GameKit GKSession link
Bonjour useful info, perhaps
GameKit GKSession useful info, perhaps
Sample application for GameKit GKSession

Thursday, April 5, 2012

Android Big Phone screen not filled up

When I put the code that ran for my Android Nexus S on the bigger Android Galaxy Note phones, the screen was not filled up completely, maybe just the top 70%. What I did to fix this was add in this line into the Manifest:

<uses-sdk android:minSdkVersion="4" />

4 or higher works. If you don't have this line, it's assumed to be 1 by default.

Monday, February 20, 2012

Installing gcc and g++ on Mac Lion 10.7.3

1. Install Xcode 4.3 by clicking "View in Mac Apple Store"
          If you want to get an Apple account without a credit card, follow this.

2. Get "Command Line Tools for Xcode" inside Xcode
           Xcode --> Open Developer Tool --> Command Line Tools for Xcode.dmg

3. You now have gcc and g++
          Type which gcc you should see /usr/bin/gcc, and which g++ you should see /usr/bin/g++


Extra notes:
- At first I cannot not find gcc in /usr/bin. Google points me to install Xcode
- After I have Xcode, gcc does not work either. I could not find /Developer. Then I read "/Developer No Longer Exists" in Xcode 4.3

Wednesday, February 1, 2012

Tuesday, January 17, 2012

Android TCP and UDP basic code examples

This is a tiny app that has examples for both android TCP and UDP communications.

Remember, you should:

TCP - start the server first, because ServerSocket.accept() blocks

UDP - start the client first, because DatagramSocket.receive() blocks