This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { | |
".read": true, | |
".write": true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DatabaseReference reference; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
FirebaseDatabase database = FirebaseDatabase.getInstance(); | |
reference = database.getReference(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Insert title here</title> | |
<script src="https://www.gstatic.com/firebasejs/4.13.0/firebase-app.js"></script> | |
<script src="https://www.gstatic.com/firebasejs/4.13.0/firebase-database.js"></script> | |
<script> | |
// Initialize Firebase | |
var config = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var five = require("johnny-five"), | |
board = new five.Board(); | |
var firebase = require('firebase'); | |
var config = { | |
apiKey: "-", | |
authDomain: "-", | |
databaseURL: "-", | |
projectId: "-", | |
storageBucket: "-", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: Felipe Herranz (felhr85@gmail.com) | |
* Contributors:Francesco Verheye (verheye.francesco@gmail.com) | |
* Israel Dominguez (dominguez.israel@gmail.com) | |
*/ | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import android.os.Handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mMessageListener = object : MessageListener() { | |
override fun onFound(message: Message?) { | |
val messageStr = String(message!!.content) | |
partsMessage = messageStr.split(" ".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() | |
txtFacebook.text = "Facebook: ${partsMessage!![0]}" | |
txtTwitter.text = "Twitter: ${partsMessage!![1]}" | |
txtLinkedin.text = "Linkedin: ${partsMessage!![1]}" | |
Picasso.get().load(partsMessage!![3]).into(imgPhoto) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mMessageListener = new MessageListener() { | |
@Override | |
public void onFound(Message message) { | |
String messageStr = new String(message.getContent()); | |
partsMessage = messageStr.split(" "); | |
txtFacebook.setText("Facebook: " + partsMessage[0]); | |
txtTwitter.setText("Twitter: " + partsMessage[1]); | |
txtLinkedin.setText("Linkedin: " + partsMessage[2]); | |
Picasso.get().load(partsMessage[3]).into(imgPhoto); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override fun onStart() { | |
super.onStart() | |
Nearby.getMessagesClient(this).subscribe(mMessageListener!!) | |
} | |
public override fun onStop() { | |
if (message != null) | |
Nearby.getMessagesClient(this).unpublish(message!!) | |
Nearby.getMessagesClient(this).unsubscribe(mMessageListener!!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onStart() { | |
super.onStart(); | |
Nearby.getMessagesClient(this).subscribe(mMessageListener); | |
} | |
@Override | |
public void onStop() { | |
if (message != null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final Strategy PUB_SUB_STRATEGY = new Strategy.Builder() | |
.setTtlSeconds(Strategy.TTL_SECONDS_MAX).build(); | |
private final PublishOptions PUB_OPTIONS = new PublishOptions.Builder() | |
.setStrategy(PUB_SUB_STRATEGY) | |
.setCallback(new PublishCallback(){ | |
@Override | |
public void onExpired() { | |
Toast.makeText( | |
MainActivity.this, |
OlderNewer