I was trying to store data to Firebase Cloud Firestore but after running my app it showed this error in the log.
[Firestore]: Write failed at Backpaper Registration/WSjZoirLf8WRBuGCVbUZ: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
This is the part of my code.
fb=FirebaseFirestore.getInstance();
map=new HashMap<String>();
map.put("Name of Department",txtDepartment);
map.put("Name of Student",txtStudentName);
map.put("Registration No",txtRegNo);
map.put("CGPA in Previous Semester",txtCgpa);
map.put("Phone",txtPhoneNo);
map.put("Email",txtEMail);
map.put("Subject 1",txtSubject1);
map.put("Subject 2",txtSubject2);
map.put("Subject 3",txtSubject3);
map.put("Subject 4",txtSubject4);
map.put("Subject 5",txtSubject5);
map.put("Payment Details(Rs.)",txtPaymentDetails);
map.put("Payment Date",txtPaymentDate);
fb.collection("Backpaper Registration").add(map).addOnCompleteListener(new OnCompleteListener<DocumentReference>() {
@Override
public void onComplete(@NonNull Task<DocumentReference> task) {
if(task.isSuccessful()){
Toast.makeText(Backpaper.this, "Registration Successful", Toast.LENGTH_SHORT).show();
startActivity(new Intent(Backpaper.this,Academic.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP));
finish();
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(Backpaper.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
Can somebody help me?