You can connect your game to a Gameloft or Facebook account in order to invite your friends to play, send Hearts to your friends, or so you can visit your friend's Ponyville and have a look around.

Sending gifts to friends and opening Treasure Chests left by friends are the only ways to obtain Hearts in the game.

You and your friend must have the same version of the game in order to connect and visit each other's Ponyvilles