Skip to content

Missing variable declaration #5

@MichaelsPlayground

Description

@MichaelsPlayground

Hi, thanks for your wonderful contribution with this Android app - it helped me a lot in understanding how to work with Firebase.

While trying to run your I received some messages from my Android Studio (I'm running Android Studio Dolphin | 2021.3.1 Patch 1 with SDK 33).

In MessagingActivity there is a missing variable declaration:

                            String decrypted = "";
                            try {
                                decrypted = AESUtils.decrypt(msg);
                            } catch (Exception er) {
                                er.printStackTrace();
                            }

My Android Studio claimed about a lot of possible "Method invocation 'toString' may produce 'NullPointerException'" like here:

String msg = e.child("msgText").getValue().toString();

I replaced all of those with the recommended

String msg = Objects.requireNonNull(e.child("msgText").getValue()).toString();

A last note: It would be perfect if you could add a simple explanation what services are needed in the Firebase setup - it took me some time to find them all (Authentication with Email and Google, Realtime Database and Storage).

Thanks again, greetings from
Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions