1

I want to see when certain methods get fired inside a native module.

I've imported

import android.util.Log;

in the java file that I want to write my log to.

Here's the method I would like to log.

public void play(int frequency, double duration, double amplitude, int mode) {
        BlueManager blueManager = BLueServiceManager.getSharedBlueManager();
        if (blueManager == null || !blueManager.isConnected()) {
            return;
        }

        byte actualFreq = (byte) (frequency / EQ_STEP_SIZE);
        short actualDuration = (short) (duration * 1800);
        blueManager.playTone(actualFreq, actualDuration, amplitude);
    }

I've attempted to add

Log.d("is this thing working???", "I certainly hope so"); 

inside the method.

I have Android Studio open and I'm looking at the Logcat window. I don't see my message anywhere even though I know that I've accessed that method.

enter image description here

2 Answers 2

1

Inside Logcat, I can see, you've selected only "info" messages to display.

enter image description here

Log.d() stands for debug messages, So, will not come under "info"(Log.i()) messages.

Change it and select "Debug". You'll see the message. Or select "Verbose" to see all the messages, whichever type.

Sign up to request clarification or add additional context in comments.

Comments

1

If you run your app on a real device :

Log.d('Notification', 'Log from the app');

you should start listening log by the command :

adb logcat -s Notification:D

Notice that 1st parameter in Log.d, a TAG for logcat command.

Complete docs here : https://developer.android.com/studio/command-line/logcat?hl=fr

1 Comment

Need to use double quotes in Log.d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.