html – Firebase error: the database is not defined



    
    
    
    
    


android – Is there a way to get the latest aggregated data without the latest from the list in Firebase?

I have a list of numbers inside that have some data, in which I add a value of "Yes" or "No", as in this picture:

enter the description of the image here

The last "Yes" that I added was that of number 4, but if I filter with Firebase with

.equalTo ("Yes"). limitToLast (1)

I return the value of "Yes" in the number 5 and not in the 4 which was the last "Yes" that I added to the database … There is a way to recognize the last "Yes" , without needing who is in the last position of the list?

I still can not find the solution, I hope you can help me.

Thank you so much.

How to use user credentials in Firebase scans?

We have been using firebase for months. But we started to put user_id via setUserId () in an Android application as follows:

firebaseAnalytics.setUserId (viewModel.userInfo.id)

I can see that these user IDs are defined in the bigquery table. So, it works perfectly well. For now, we have only done this on test devices, this field is defined for 5 to 10 users only (visible in the bigquery table).

Now, when I try to create an audience via "User ID" in Firebase Analytics, it displays random numbers for users based on "User ID".

enter the description of the image here

In addition, it shows 0 results for the exact user ID that I can see in a large query table. Screenshot is as follows:

enter the description of the image here

Can you please tell me what's wrong with Firebase or if I'm doing something wrong. I can see the good user_id in the bigquery table.

javascript – E possível had u userauid um usa user.uid información of um no firebase?

Tava faltando apenas is also a dar certo project:

if (user) {
uid = user.uid;
}
});

e editar a linha:

var messagesRef = firebase.database (). ref (& # 39;) & # 39;). child (user.uid) .child (& # 39; address); 

Para:

var messagesRef = firebase.database (). ref (& # 39;) & # 39;). child (uid); 

E código ficou assim:

// Initialize Firebase (ADD YOUR OWN DATA)
var config = {
apiKey: "xxxxxxxxxxxxxxxxx",
authDomain: "xxxxxxxxxxxxxxxxxxxxxxxx"
databaseURL: "xxxxxxxxxxxxxxxxxxxxxx",
projectId: "xxxxxxxxxxxxxxxxxxxxxx",
storageBucket: "xxxxxxxxxxxxxxxxxxxx"
messagingSenderId: "xxxxxxxxxxxxxxxxxxxx"
};
firebase.initializeApp (config);
firebase.auth (). onAuthStateChanged (function (user) {
if (user) {
uid = user.uid;
// Collection of reference messages
var messagesRef = firebase.database (). ref (& # 39;) & # 39;). child (uid);
// Listen to the form to submit
document.getElementById (& # 39; trocoForm & # 39;). addEventListener ('submit', submitForm);
// Submit the form
submitForm (e) function
e.preventDefault ();
// Get values
var troco = getInputVal (& # 39; troco & # 39;);
// Save the message
saveTroco (troco);
// Show the alert
// por alert aqui
// Clear form
document.getElementById (& # 39; trocoForm & # 39;). reset ();
}
// Function to get the values ​​of the form
getInputVal function (id) {
return document.getElementById (id) .value;
}
// Save the message in the fire database
saveTroco function (troco) {
var newTrocoRef = messagesRef.push ();
newTrocoRef.set ({
troco_id: troco,
});
}
}
});

Tava faltando eu deixar claro para o código quem era o uid.

How to generate a firebase registration token on Android

I've integrated Firebase as a server in my Android application. I try to change the device ID of the user at each application opening.

I'm using the code below to get the Firebase registry ID:

FirebaseInstanceId.getInstance (). GetInstanceId ()
.addOnCompleteListener (new OnCompleteListener() {
@Override
empty public onComplete (@NonNull Task task) {
if (! task.isSuccessful ()) {
Log.w (TAG, "getInstanceId failed", task.getException ());
return;
}

// Get the instance ID token
String token = task.getResult (). GetToken ();

Toast.makeText (MainActivity.this, token, Toast.LENGTH_SHORT) .show ();
}
});

How can I change this token each time users open an app?
Any help would be appreciated.

THANK YOU

Recover the user image in firebase

What I want is to get the user image from any user with a fire base. I currently have the UID of the user. Is there a way to pass the UID by returning user data?

Use Firebase authentication for users.

database – Trying to choose between Firebase and MySQL for a new site

I'm looking for advice on the pros and cons of MySQL and Firebase when it comes to developing a new site for my business. We are a B2B wholesale company that is redesigning our site from scratch. The main purpose of this site is to enable customers to have a self-service system allowing them to browse products and quickly make their own quotes, and to integrate payment gateways for payment by credit card in the near future. Credit, Paypal and Wire Transfer.

We contacted a few web development companies to develop proposals for the new site. I've reduced it to a few proposals, but today, the topic of using Firebase or MySQL for the site has been touched upon. I am a marketing professional. Although I am also a technology technician and have a basic knowledge of web technologies, I am by no means a developer. I would like to collect as many opinions as possible to help me make a decision. on this topic.

The initial website would have the self service system with inventory management for aprox. 200 products, with several variants in most of them, for different variables combined (size, color, materials, packaging) and several price scales; a registered user space with the order history, customer details, etc., as well as the usual functions of a professional website. The site would be in two languages ​​(English and Spanish), with the possibility of adding a third in the future.

In the short term, we would like to evaluate customer feedback and user experience to decide if we should develop a progressive web application so that our customers can access the system more easily. As we do not expect to need to use the hardware of a phone (GPS, accelerometer, etc.), we think that a native application would be excessive and we think our customers would appreciate the small size and the rapid installation of a PWA.

In the medium and long term, we would add more products, categories, shipping options (some with SDK and API to external vendors) and payment processing; as well as other product images, perhaps product videos and a resource section with tutorials and industry white papers; and increase traffic not only new customers, local and foreign, but also by encouraging existing customers to use the self-service system. We also considered leaving the door open to third-party vendors who may be interested in selling related products through our platform.

All that considered, what would you recommend we choose for a database system? Firebase or MySQL? Considering that my main concerns for the site are scalability, performance / UX, efficiency, cost of hosting, as well as the sustainability of the system vis-à-vis new technologies and tools that we might want implement on the system.

I am aware that no system is perfect and we will have to sacrifice some of these things for others, but I would still like to know your opinion in order to make an informed decision. I've read about Firebase, but most of the articles I've found about this are a few years old and I'm not sure that the issues raised in 2017 are still valid today.

Thank you very much for your contribution and your thoughts, and if I forgot to add any relevant information, please let me know.

firebase – Firestore.settings () requires that its first argument be of type object but that it is a custom object

I can not call the firebase.firestore () function. Settings () because I get this way "requires that its first argument be object type" error:

firebase.firestore (). settings ({timestampsInSnapshots: true})

I do not understand this error, but as a workaround, I tried to create an object as well:

const firestoreSettings = Object.create ({timestampsInSnapshots: true})
firebase.firestore (). parameters (firestoreSettings)

It did not work either.

Where does this error come from and how to solve it?

javascript – Error while using map () in ReacNative with Firebase

React-Native and Firebase are new to me and I can not get the information from the database (Firebase) in the application via React-Native. I want to get names, schedules and acronyms, and print everything in one in one , forming a content list. Then it would look like this:


    Alexander ... 
    Monday 19h30 ... 
    EA215 ... 



    André ... 
    Monday 5 pm ... 
    EE014  




.
.
.

Note: When I did the code that way:

let items = Object.keys (data);
// let items2 = Object.values ​​(data);
this.setState ({items});

The code m returned the names and I could print them.
And when I used the code this way:

// let items = Object.keys (data);
let items2 = Object.values ​​(data);
this.setState ({items2});

The code m returned appendices and acronyms, it would depend on what i would put if it was elements2.Sigla_Prof or items2.Profile

But when I use two objects this way:

let items = Object.keys (data);
let items2 = Object.values ​​(data);
this.setState ({items, items2});

The error code saying that the this.props.items2.map it is not an object.
Why does this happen? And how can I solve this problem? How can I bring him names, schedules and acronyms?

Fire base

insert the description of the image here

Code 1

insert the description of the image here

Code 2

insert the description of the image here

Fault

insert the description of the image here

java – How to get the key value of the firebase node from the recyclerview position?

I use OnScrollListener for recyclerview to get the position of the current visible element on the screen

Protected void onCreate (Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);

postList = (RecyclerView) findViewById (R.id.all_user_post_list);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager (this);
postList.setLayoutManager (linearLayoutManager);

postList.addOnScrollListener (new RecyclerView.OnScrollListener () {
@Override
public void onScrollStateChanged (@NoNull RecyclerView recycleView, int newState) {
super.onScrollStateChanged (recyclerView, newState);

switch (newState) {
case RecyclerView.SCROLL_STATE_IDLE:
System.out.println ("The RecyclerView does not scroll");
LinearLayoutManager layoutManager = (((LinearLayoutManager) postList.getLayoutManager ());

firstVisiblePosition = layoutManager.findFirstVisibleItemPosition ();

Toast.makeText (MainActivity.this, String.valueOf (firstVisiblePosition), Toast.LENGTH_SHORT) .show (); ** // Here is the position // **
Pause;
case RecyclerView.SCROLL_STATE_DRAGGING:
System.out.println ("Scrolling now");
Pause;
case RecyclerView.SCROLL_STATE_SETTLING:
System.out.println ("Scroll Settling");
Pause;
}
}

@Override
public void onScrolled (@NoNull RecyclerView recycleView, int dx, int dy) {
super.onScrolled (recyclerView, dx, dy);
}
});

Query sortPost = PostRef
FirebaseRecyclerOptions options = new FirebaseRecyclerOptions.Builder() .setQuery (sortPost, Post.class) .build ();
FirebaseRecyclerAdapter firebaseRecyclerAdapter = new FirebaseRecyclerAdapter(Options)
{
@Override
onBindViewHolder protected void (@ PostsViewHolder final @NonNull holder, final final position, final post template @NonNull)
{

final String PostKey = getRef (position) .getKey ();
}

in the onBindViewHolder method, I get the postkey of the getRef () method.

But now, I also want to recover the recyclerview post-key.
Means whenever SCROLL_STATE_IDLE I want to retrieve the post-key from the visible position of recyclerview (firstVisiblePosition).