Firebase Firestore not connecting










0














I have a problem that drives me crazy. I try to populate Firestore db with some tests fields. First time when i tried it worked perfectly, i did some modifications and nothing seems to work right now. The problem is that set/add are never called whatever i do. I can create and log in without problems. I don't post layout because is self explanatory. A button that set data: add_ddb. Thanks.



class StartingActivity : AppCompatActivity() 


private lateinit var firebaseFirestore: FirebaseFirestore
private val firebaseAuth by lazy FirebaseAuth.getInstance()
private var uid = firebaseAuth.currentUser?.uid


override fun onCreate(savedInstanceState: Bundle?)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_starting)
firebaseFirestore = FirebaseFirestore.getInstance()

setSupportActionBar(toolbar)
supportActionBar?.apply
setDisplayHomeAsUpEnabled(true)
setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp)

add_ddb.setOnClickListener vieew->
val detail = mutableMapOf<String, Any>()
detail.put("nameOfDocument","sdsad")
detail.put("documentNumber","sdasdvc")
firebaseFirestore.collection("users").document("asda").
set(detail).addOnSuccessListener
Toast.makeText(this,"sdasdasdasda",Toast.LENGTH_SHORT).show()
.addOnFailureListener
Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show()


nav_view.apply
setNavigationItemSelectedListener
it.isChecked = true
drawer_layout.closeDrawers()
when (it.itemId)
R.id.nav_signOut ->
signOut()
true

else -> false




recycler.apply
layoutManager = LinearLayoutManager(applicationContext)

DisplayInRecycler(this).displayDetails(recycler)

fab.setOnClickListener
startActivity(intentFor<ActivityAdd>())




override fun onOptionsItemSelected(item: MenuItem?): Boolean
return when (item?.itemId)
android.R.id.home ->
drawer_layout.openDrawer(Gravity.START)
true

else -> super.onOptionsItemSelected(item)






fun signOut()
FirebaseAuth.getInstance().signOut()
startActivity(intentFor<SignInActivity>().clearTop().clearTask())
finish()











share|improve this question























  • Make sure your rules allow you to read/write to the database
    – Rafael
    Nov 12 at 15:36










  • service cloud.firestore match /databases/database/documents match /document=** allow read, write;
    – Ionuţ Grigore
    Nov 12 at 15:37










  • It's very very strange, i don't understand why...
    – Ionuţ Grigore
    Nov 12 at 15:37










  • @IonuţGrigore Does this line: Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show() display something? Please responde with @AlexMamo
    – Alex Mamo
    Nov 12 at 15:44










  • @AlexMamo Nothing...
    – Ionuţ Grigore
    Nov 12 at 16:13















0














I have a problem that drives me crazy. I try to populate Firestore db with some tests fields. First time when i tried it worked perfectly, i did some modifications and nothing seems to work right now. The problem is that set/add are never called whatever i do. I can create and log in without problems. I don't post layout because is self explanatory. A button that set data: add_ddb. Thanks.



class StartingActivity : AppCompatActivity() 


private lateinit var firebaseFirestore: FirebaseFirestore
private val firebaseAuth by lazy FirebaseAuth.getInstance()
private var uid = firebaseAuth.currentUser?.uid


override fun onCreate(savedInstanceState: Bundle?)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_starting)
firebaseFirestore = FirebaseFirestore.getInstance()

setSupportActionBar(toolbar)
supportActionBar?.apply
setDisplayHomeAsUpEnabled(true)
setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp)

add_ddb.setOnClickListener vieew->
val detail = mutableMapOf<String, Any>()
detail.put("nameOfDocument","sdsad")
detail.put("documentNumber","sdasdvc")
firebaseFirestore.collection("users").document("asda").
set(detail).addOnSuccessListener
Toast.makeText(this,"sdasdasdasda",Toast.LENGTH_SHORT).show()
.addOnFailureListener
Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show()


nav_view.apply
setNavigationItemSelectedListener
it.isChecked = true
drawer_layout.closeDrawers()
when (it.itemId)
R.id.nav_signOut ->
signOut()
true

else -> false




recycler.apply
layoutManager = LinearLayoutManager(applicationContext)

DisplayInRecycler(this).displayDetails(recycler)

fab.setOnClickListener
startActivity(intentFor<ActivityAdd>())




override fun onOptionsItemSelected(item: MenuItem?): Boolean
return when (item?.itemId)
android.R.id.home ->
drawer_layout.openDrawer(Gravity.START)
true

else -> super.onOptionsItemSelected(item)






fun signOut()
FirebaseAuth.getInstance().signOut()
startActivity(intentFor<SignInActivity>().clearTop().clearTask())
finish()











share|improve this question























  • Make sure your rules allow you to read/write to the database
    – Rafael
    Nov 12 at 15:36










  • service cloud.firestore match /databases/database/documents match /document=** allow read, write;
    – Ionuţ Grigore
    Nov 12 at 15:37










  • It's very very strange, i don't understand why...
    – Ionuţ Grigore
    Nov 12 at 15:37










  • @IonuţGrigore Does this line: Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show() display something? Please responde with @AlexMamo
    – Alex Mamo
    Nov 12 at 15:44










  • @AlexMamo Nothing...
    – Ionuţ Grigore
    Nov 12 at 16:13













0












0








0







I have a problem that drives me crazy. I try to populate Firestore db with some tests fields. First time when i tried it worked perfectly, i did some modifications and nothing seems to work right now. The problem is that set/add are never called whatever i do. I can create and log in without problems. I don't post layout because is self explanatory. A button that set data: add_ddb. Thanks.



class StartingActivity : AppCompatActivity() 


private lateinit var firebaseFirestore: FirebaseFirestore
private val firebaseAuth by lazy FirebaseAuth.getInstance()
private var uid = firebaseAuth.currentUser?.uid


override fun onCreate(savedInstanceState: Bundle?)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_starting)
firebaseFirestore = FirebaseFirestore.getInstance()

setSupportActionBar(toolbar)
supportActionBar?.apply
setDisplayHomeAsUpEnabled(true)
setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp)

add_ddb.setOnClickListener vieew->
val detail = mutableMapOf<String, Any>()
detail.put("nameOfDocument","sdsad")
detail.put("documentNumber","sdasdvc")
firebaseFirestore.collection("users").document("asda").
set(detail).addOnSuccessListener
Toast.makeText(this,"sdasdasdasda",Toast.LENGTH_SHORT).show()
.addOnFailureListener
Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show()


nav_view.apply
setNavigationItemSelectedListener
it.isChecked = true
drawer_layout.closeDrawers()
when (it.itemId)
R.id.nav_signOut ->
signOut()
true

else -> false




recycler.apply
layoutManager = LinearLayoutManager(applicationContext)

DisplayInRecycler(this).displayDetails(recycler)

fab.setOnClickListener
startActivity(intentFor<ActivityAdd>())




override fun onOptionsItemSelected(item: MenuItem?): Boolean
return when (item?.itemId)
android.R.id.home ->
drawer_layout.openDrawer(Gravity.START)
true

else -> super.onOptionsItemSelected(item)






fun signOut()
FirebaseAuth.getInstance().signOut()
startActivity(intentFor<SignInActivity>().clearTop().clearTask())
finish()











share|improve this question















I have a problem that drives me crazy. I try to populate Firestore db with some tests fields. First time when i tried it worked perfectly, i did some modifications and nothing seems to work right now. The problem is that set/add are never called whatever i do. I can create and log in without problems. I don't post layout because is self explanatory. A button that set data: add_ddb. Thanks.



class StartingActivity : AppCompatActivity() 


private lateinit var firebaseFirestore: FirebaseFirestore
private val firebaseAuth by lazy FirebaseAuth.getInstance()
private var uid = firebaseAuth.currentUser?.uid


override fun onCreate(savedInstanceState: Bundle?)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_starting)
firebaseFirestore = FirebaseFirestore.getInstance()

setSupportActionBar(toolbar)
supportActionBar?.apply
setDisplayHomeAsUpEnabled(true)
setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp)

add_ddb.setOnClickListener vieew->
val detail = mutableMapOf<String, Any>()
detail.put("nameOfDocument","sdsad")
detail.put("documentNumber","sdasdvc")
firebaseFirestore.collection("users").document("asda").
set(detail).addOnSuccessListener
Toast.makeText(this,"sdasdasdasda",Toast.LENGTH_SHORT).show()
.addOnFailureListener
Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show()


nav_view.apply
setNavigationItemSelectedListener
it.isChecked = true
drawer_layout.closeDrawers()
when (it.itemId)
R.id.nav_signOut ->
signOut()
true

else -> false




recycler.apply
layoutManager = LinearLayoutManager(applicationContext)

DisplayInRecycler(this).displayDetails(recycler)

fab.setOnClickListener
startActivity(intentFor<ActivityAdd>())




override fun onOptionsItemSelected(item: MenuItem?): Boolean
return when (item?.itemId)
android.R.id.home ->
drawer_layout.openDrawer(Gravity.START)
true

else -> super.onOptionsItemSelected(item)






fun signOut()
FirebaseAuth.getInstance().signOut()
startActivity(intentFor<SignInActivity>().clearTop().clearTask())
finish()








android firebase kotlin google-cloud-firestore






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 16:35









Frank van Puffelen

227k28372397




227k28372397










asked Nov 12 at 15:17









Ionuţ Grigore

164




164











  • Make sure your rules allow you to read/write to the database
    – Rafael
    Nov 12 at 15:36










  • service cloud.firestore match /databases/database/documents match /document=** allow read, write;
    – Ionuţ Grigore
    Nov 12 at 15:37










  • It's very very strange, i don't understand why...
    – Ionuţ Grigore
    Nov 12 at 15:37










  • @IonuţGrigore Does this line: Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show() display something? Please responde with @AlexMamo
    – Alex Mamo
    Nov 12 at 15:44










  • @AlexMamo Nothing...
    – Ionuţ Grigore
    Nov 12 at 16:13
















  • Make sure your rules allow you to read/write to the database
    – Rafael
    Nov 12 at 15:36










  • service cloud.firestore match /databases/database/documents match /document=** allow read, write;
    – Ionuţ Grigore
    Nov 12 at 15:37










  • It's very very strange, i don't understand why...
    – Ionuţ Grigore
    Nov 12 at 15:37










  • @IonuţGrigore Does this line: Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show() display something? Please responde with @AlexMamo
    – Alex Mamo
    Nov 12 at 15:44










  • @AlexMamo Nothing...
    – Ionuţ Grigore
    Nov 12 at 16:13















Make sure your rules allow you to read/write to the database
– Rafael
Nov 12 at 15:36




Make sure your rules allow you to read/write to the database
– Rafael
Nov 12 at 15:36












service cloud.firestore match /databases/database/documents match /document=** allow read, write;
– Ionuţ Grigore
Nov 12 at 15:37




service cloud.firestore match /databases/database/documents match /document=** allow read, write;
– Ionuţ Grigore
Nov 12 at 15:37












It's very very strange, i don't understand why...
– Ionuţ Grigore
Nov 12 at 15:37




It's very very strange, i don't understand why...
– Ionuţ Grigore
Nov 12 at 15:37












@IonuţGrigore Does this line: Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show() display something? Please responde with @AlexMamo
– Alex Mamo
Nov 12 at 15:44




@IonuţGrigore Does this line: Toast.makeText(this,it.toString(),Toast.LENGTH_SHORT).show() display something? Please responde with @AlexMamo
– Alex Mamo
Nov 12 at 15:44












@AlexMamo Nothing...
– Ionuţ Grigore
Nov 12 at 16:13




@AlexMamo Nothing...
– Ionuţ Grigore
Nov 12 at 16:13

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265108%2ffirebase-firestore-not-connecting%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265108%2ffirebase-firestore-not-connecting%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3