samedi 9 juillet 2016

Send an object from a java application to an Android application via Bluetooth?

I need to send an object from a java application that runs on my laptop to an Android device via Bluetooth. The class is the following:

public class Contact {
    private static int counter = 0;
    private int id;
    private String firstName;
    private String lastName;
    private String email;

    public Contact(String firstName, String lastName, String email) {
        this.id = ++counter;
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public String getEmail() {
        return email;
    }
}

I have no idea what library or API to use in order to send data. I think that, first, I have to pair both devices, but I have no idea how to do it neither. After pairing I think that I should have a listener in my Android application that is executed when data has been received, shouldn't I?

I hope you can help me because I totally stuck.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire