0

I am trying to integrate BUMP API into my app. Documentation for the same in their site is not good enough. I have downloaded the sample called BumpTest provided on Github and got an API key. I am trying to simulate a bump between my phone and the emulator which are o same WIFI with GPS turned on!. But I dont see any matches/bumps in my logcat. Please help me!!

private final ServiceConnection connection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName className, IBinder binder) {
        Log.i("BumpTest", "onServiceConnected");
        api = IBumpAPI.Stub.asInterface(binder);
        try {
            api.configure("MY KEY",
                          "Bump User");
        } catch (RemoteException e) {
            Log.w("BumpTest", e);
        }
        bump.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    api.simulateBump();
                    sendBroadcast(new Intent(BumpAPIIntents.BUMPED));
                } catch (RemoteException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            }
        });
        Log.d("Bump Test", "Service connected");

    }

    @Override
    public void onServiceDisconnected(ComponentName className) {
        Log.d("Bump Test", "Service disconnected");
    }
};

private final BroadcastReceiver receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        final String action = intent.getAction();
        try {
            if (action.equals(BumpAPIIntents.DATA_RECEIVED)) {
                Log.i("Bump Test", "Received data from: " + api.userIDForChannelID(intent.getLongExtra("channelID", 0))); 
                Log.i("Bump Test", "Data: " + new String(intent.getByteArrayExtra("data")));
            } else if (action.equals(BumpAPIIntents.MATCHED)) {
                long channelID = intent.getLongExtra("proposedChannelID", 0); 
                Log.i("Bump Test", "Matched with: " + api.userIDForChannelID(channelID));
                api.confirm(channelID, true);
                Log.i("Bump Test", "Confirm sent");
            } else if (action.equals(BumpAPIIntents.CHANNEL_CONFIRMED)) {
                long channelID = intent.getLongExtra("channelID", 0);
                Log.i("Bump Test", "Channel confirmed with " + api.userIDForChannelID(channelID));
                api.send(channelID, "Hello, world!".getBytes());
            } else if (action.equals(BumpAPIIntents.NOT_MATCHED)) {
                Log.i("Bump Test", "Not matched.");
            } else if (action.equals(BumpAPIIntents.CONNECTED)) {
                Log.i("Bump Test", "Connected to Bump...");
                api.enableBumping();
            }
        } catch (RemoteException e) {}
    } 
};
CodeFury
  • 1,520
  • 16
  • 29
  • hey can you tell me how can you solve that problem.i had also getting demo from github and also get newest api key but i can't so the log while running in device.what you have done for that please tell me. – Google Oct 18 '12 at 06:11
  • othewise can you give me your demo which you have done.i will change the api key tested it in my side.please. – Google Oct 18 '12 at 06:12
  • enter this "MY KEY","Bump User". – Android Oct 18 '12 at 11:04

1 Answers1

0

It was my bad. My API key was wrong and i got a correct one and It is getting connected now. But I have a similar application in iPhone with using the same API key which is not getting paired with my Android version, error message is "No match found". Cross platform connections are supported by Bump API as per their docs if we use the same API key. Appreciate your help in this.

CodeFury
  • 1,520
  • 16
  • 29