Reputation: 51
I'm not be able to access the Database, means Its not giving me any response while I writing into the database. I don't have any Type of authentication just for temporary I use firebase but it's not allowing me to read and write into the database.
Is it compulsory to have the authentication to access the Database?
I also set up the database rules to the auth==null..
Still no response..
My Code :
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button=(Button)findViewById(R.id.bt);
button.setOnClickListener(this);
}
@Override
public void onClick(View v) {
TextView textView=(TextView)findViewById(R.id.tv);
DatabaseReference databaseReference= FirebaseDatabase.getInstance().getReference();
databaseReference.child("User").setValue(textView.getText().toString());
}
}
Upvotes: 4
Views: 10449
Reputation: 1
If Firebase code is not responding ReDownload your Json file from firebase project and Replace it over old one.
Delete installed apks and run again.
Worked for me.
Upvotes: 0
Reputation: 224
If even rules are added and this problem is happening then your firebase location is not USA and you ll have to enter the databaseURL in getInstance(URL)
Upvotes: 0
Reputation: 14918
i also faced same problem 1 week after that i found a solution is OFF WIFI and TEST USING MOBILE DATA. it worked form me.
Upvotes: 2
Reputation: 51
Actually The issue I got that it's not working with my mobile data , but when I connect to a WiFi network firebase is working fine in android.. I checked my setting also but its all correct...
Upvotes: 1
Reputation: 92
Please check your Google Play Services version.
For firebase to work, it needs :-
Make sure you are using all the right version of dependencies, check here Firebase Prerequisites
For now have these rules,
{
"rules": {
".read": true,
".write": true
}
}
And finally, make sure you are connected to internet because Google Play Services API does a download at the first time it is used.
Upvotes: 1