Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"path" variable from onReceived Intent extra is always null, causing app to crash. #172

Open
smazyck2 opened this issue Apr 21, 2020 · 0 comments

Comments

@smazyck2
Copy link

smazyck2 commented Apr 21, 2020

Android Galaxy Note10+ not receiving MMS due to 'intent.getStringExtra("file_path")' always being null in the MmsReceivedReceiver class. After the phone receives the MMS message, the broadcast receiver's "onReceive" method is called, however the 'path' variable is always null.

2020-04-21 09:11:54.775 4864-4864/com.example.messageforwarder E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.messageforwarder, PID: 4864
java.lang.RuntimeException: Unable to start receiver com.example.messageforwarder.TestReceiver: java.lang.NullPointerException: println needs a message
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4120)
at android.app.ActivityThread.access$1700(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at android.util.Log.v(Log.java:136)
at com.klinker.android.send_message.MmsReceivedReceiver.onReceive(MmsReceivedReceiver.java:93)

public final void onReceive(final Context context, final Intent intent) {
Log.v("MmsReceivedReceiver", "MMS has finished downloading, persisting it to the database");
final String path = intent.getStringExtra("file_path");
final int subscriptionId = intent.getIntExtra("subscription_id", Utils.getDefaultSubscriptionId());
Log.v("MmsReceivedReceiver", path);
--> app crashes, because 'path' is always null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant