43

Any good documentation or articles out there about doing device-to-device data transfer?

iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
Dave
  • 709
  • 1
  • 6
  • 12

3 Answers3

57

Pretty non-technical, but their FAQ gives some information on the technology:

Q: How does Bump work?

A: There are two parts to Bump: the app running on your device and a smart matching algorithm running on our servers in the cloud. The app on your phone uses the phone's sensors to literally "feel" the bump, and it sends that info up to the cloud. The matching algorithm listens to the bumps from phones around the world and pairs up phones that felt the same bump. Then we just route information between the two phones in each pair.

Q: No way. What if somebody else bumps at the same time?

A: Way. We use various techniques to limit the pool of potential matches, including location information and characteristics of the bump event. If you are bumping in a particularly dense area (ex, at a conference), and we cannot resolve a unique match after a single bump, we'll just ask you to bump again. Our CTO has a PhD in Quantum Mechanics and can show the math behind that, but we suggest downloading Bump and trying it yourself!

Q: Why does Bump want to use my location?

A: We've got millions of users worldwide now. We use location information as one of the ways we limit the number of other phones we have to check to determine the correct match. Basically, if you are in Chicago, we use that info so we don't have to compare your bump with bumps coming in from Japan, Europe, New York, etc. For this reason, we require that location services be turned on and that users authorize the use of their location information. If you do not authorize use of location information, Bump won't work, sorry.

Q: Does Bump require that my Bluetooth is activated also?

A: Nope! Bump doesn't use Bluetooth to work at all; all you need is an Internet connection through wifi, 3G or Edge.

Community
  • 1
  • 1
Skilldrick
  • 69,215
  • 34
  • 177
  • 229
  • 4
    Can you shed some light on why Bump uses a cloud based approach over Bluetooth to initiate a transfer? –  Mar 30 '11 at 23:45
  • 2
    Cause in iphone bluetooth framework is open in only jail broken iphones. – Robin Dec 07 '11 at 07:56
  • @Robin you can always use GameKit. –  Feb 25 '12 at 15:57
  • @daknøk, I tried to use game kit as an alternative for bump in one of my clients application, but found a lot of problems while developing the app and then have to switch to bump. – Robin Feb 26 '12 at 05:03
  • Is data transferred using p2p after the connection established? – Parvin Gasimzade May 04 '12 at 08:08
  • Please help Can anyone Please tell me how to bound bump with in 2 meters. Actually my bump works even when two users are not near to each other. – LuminiousAndroid Apr 25 '13 at 08:31
9

You may be confusing how Bump functions. My understanding is that accelerometer and geolocation data is used to identify candidate "bumps," or device pairs. The contact data, itself, is transferred over the Internet, not locally via Bluetooth or wifi.

Justin
  • 20,509
  • 6
  • 47
  • 58
4

Complete Example from https://github.com/bumptech/bump-api-ios

- (void) configureBump {
// userID is a string that you could use as the user's name, or an ID that is semantic within your environment
[BumpClient configureWithAPIKey:@"your_api_key" andUserID:[[UIDevice currentDevice] name]];

[[BumpClient sharedClient] setMatchBlock:^(BumpChannelID channel) { 
    NSLog(@"Matched with user: %@", [[BumpClient sharedClient] userIDForChannel:channel]); 
    [[BumpClient sharedClient] confirmMatch:YES onChannel:channel];
}];

[[BumpClient sharedClient] setChannelConfirmedBlock:^(BumpChannelID channel) {
    NSLog(@"Channel with %@ confirmed.", [[BumpClient sharedClient] userIDForChannel:channel]);
    [[BumpClient sharedClient] sendData:[[NSString stringWithFormat:@"Hello, world!"] dataUsingEncoding:NSUTF8StringEncoding]
                              toChannel:channel];
}];

[[BumpClient sharedClient] setDataReceivedBlock:^(BumpChannelID channel, NSData *data) {
    NSLog(@"Data received from %@: %@", 
    [[BumpClient sharedClient] userIDForChannel:channel], 
    [NSString stringWithCString:[data bytes] encoding:NSUTF8StringEncoding]);
}];


// optional callback
[[BumpClient sharedClient] setConnectionStateChangedBlock:^(BOOL connected) {
    if (connected) {
        NSLog(@"Bump connected...");
    } else {
        NSLog(@"Bump disconnected...");
    }
}];

// optional callback
[[BumpClient sharedClient] setBumpEventBlock:^(bump_event event) {
    switch(event) {
        case BUMP_EVENT_BUMP:
            NSLog(@"Bump detected.");
            break;
        case BUMP_EVENT_NO_MATCH:
            NSLog(@"No match.");
            break;
    }
}];

}

Sebastian
  • 6,154
  • 5
  • 33
  • 51
  • This answer is outdated, the mentioned library has a proprietary part that doesn't work on modern architectures – edwardmp May 31 '22 at 13:15