In the code section below, I wanted to test the data in the log, but I get a null value, so I cannot access data from outside. I would be very glad if you could help.
I want to get value from outside. I can't do it. I'm new, please help with this.
Thanks.
public class MyApplication extends Application {
AppLangSessionManager appLangSessionManager;
public String isvip;
public Boolean isads;
@Override
public void onCreate() {
super.onCreate();
FirebaseMessaging.getInstance().subscribeToTopic("all");
appLangSessionManager = new AppLangSessionManager(getApplicationContext());
}
public void isVip() {
FirebaseFirestore firebaseFirestore = FirebaseFirestore.getInstance();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String email = user.getEmail();
CollectionReference collectionReference = firebaseFirestore.collection("Users");
collectionReference.whereEqualTo("user_mail",email).addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@Nullable QuerySnapshot value, @Nullable FirebaseFirestoreException e) {
if (e != null)
{
Toast.makeText(MyApplication.this,e.getLocalizedMessage().toString(),Toast.LENGTH_LONG).show();
}
if (value != null)
{
for (DocumentSnapshot snapshot : value.getDocuments())
{
Map<String,Object> data = snapshot.getData();
Boolean deger = (Boolean) data.get("user_vip");
isvip = "OK";
}
}
}
});
System.out.println("Değer "+isvip);
}
}