Comments (5)
Hey @Mohanedy98
Would be great if you could provide me with a reproducible example that I can run on my end and investigate the error.
from telephony.
Closing this for now. Feel free to reopen.
from telephony.
I have the same problem.
It happened without any particular reason.
all my previous commits too.
I don't know why
here is full details on my problem
my flutter doctor is ok too
D/AndroidRuntime(19650): Shutting down VM
E/AndroidRuntime(19650): FATAL EXCEPTION: main
E/AndroidRuntime(19650): Process: com.irstake.webviewApp, PID: 19650
E/AndroidRuntime(19650): java.lang.RuntimeException: Unable to start receiver com.shounakmulay.telephony.sms.IncomingSmsReceiver: java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.view.FlutterCallbackInformation.callbackLibraryPath' on a null object reference in method 'java.lang.String io.flutter.embedding.engine.dart.DartExecutor$DartCallback.toString()'
E/AndroidRuntime(19650): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4770)
E/AndroidRuntime(19650): at android.app.ActivityThread.access$1700(ActivityThread.java:310)
E/AndroidRuntime(19650): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2292)
E/AndroidRuntime(19650): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(19650): at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(19650): at android.os.Looper.loop(Looper.java:313)
E/AndroidRuntime(19650): at android.app.ActivityThread.main(ActivityThread.java:8663)
E/AndroidRuntime(19650): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19650): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/AndroidRuntime(19650): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/AndroidRuntime(19650): Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.view.FlutterCallbackInformation.callbackLibraryPath' on a null object reference in method 'java.lang.String io.flutter.embedding.engine.dart.DartExecutor$DartCallback.toString()'
E/AndroidRuntime(19650): at io.flutter.embedding.engine.dart.DartExecutor$DartCallback.toString(DartExecutor.java:421)
E/AndroidRuntime(19650): at java.lang.String.valueOf(String.java:3657)
E/AndroidRuntime(19650): at java.lang.StringBuilder.append(StringBuilder.java:132)
E/AndroidRuntime(19650): at io.flutter.embedding.engine.dart.DartExecutor.executeDartCallback(DartExecutor.java:175)
E/AndroidRuntime(19650): at com.shounakmulay.telephony.sms.IncomingSmsHandler.startBackgroundIsolate(IncomingSmsHandler.kt:154)
E/AndroidRuntime(19650): at com.shounakmulay.telephony.sms.IncomingSmsReceiver.processInBackground(IncomingSmsHandler.kt:95)
E/AndroidRuntime(19650): at com.shounakmulay.telephony.sms.IncomingSmsReceiver.processIncomingSms(IncomingSmsHandler.kt:82)
E/AndroidRuntime(19650): at com.shounakmulay.telephony.sms.IncomingSmsReceiver.onReceive(IncomingSmsHandler.kt:50)
E/AndroidRuntime(19650): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4761)
E/AndroidRuntime(19650): ... 9 more
I get this error whenever an sms message is recieved.
it happens in this function, the stack trace does not point to anything in the function, even if the function is empty, I still get this error.
public class SmsListenerService extends Service {
// this is a java android service that I'm running, it is a foreground service.
...
private void handleSmsReceived(Intent intent) {
// problem happens here
// whenever an sms message is received this method is called
// the stack trace doesn't point to this nor anything in my code
}
...
}
Important note
please note that I didn't encounter this error yesterday at all!
I tried falling back to previous commits and check if the error is still there, and the error is everywhere!
even on the commits that I know are stable and worked.
so in short, something weird happened. I didn't touch my project since yesterday and it is ruined, and I don't know why, and all of the commits are ruined too.
What the hell is going on?
Edit:
I tried upgrading flutter but no help, I tried flutter clean but nothing changed, this happend suddenly, my code worked,
i didn't change anything, it showed up with no reason
flutter doctor just in case:
[✓] Flutter (Channel stable, 3.16.5, on Kali GNU/Linux Rolling 6.4.0-kali3-amd64, locale en_US.UTF-8)
• Flutter version 3.16.5 on channel stable at /home/yolo/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 78666c8dc5 (3 weeks ago), 2023-12-19 16:14:14 -0800
• Engine revision 3f3e560236
• Dart version 3.2.3
• DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /home/yolo/Android/Sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /home/yolo/android-studio-chipmunk/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 3.0)
• Android Studio at /home/yolo/android-studio-old
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version openjdk version "1.8.0_152-release"
[✓] Android Studio (version 2021.2)
• Android Studio at /home/yolo/android-studio-chipmunk
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version openjdk version "11.0.12" 2021-07-20
[✓] IntelliJ IDEA Community Edition (version 2022.1)
• IntelliJ at /home/yolo/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.6008.13
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] IntelliJ IDEA Community Edition (version 2023.1)
• IntelliJ at /home/yolo/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/231.9011.34
• Flutter plugin version 74.0.4
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.81.1)
• VS Code at /usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• SM A225F (mobile) • R58R918KD3B • android-arm64 • Android 12 (API 31)
• Linux (desktop) • linux • linux-x64 • Kali GNU/Linux Rolling 6.4.0-kali3-amd64
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
from telephony.
Hey @Mohanedy98
Would be great if you could provide me with a reproducible example that I can run on my end and investigate the error.
if you want I can send you a copy of my app, so you can investigate
package com.irstake.webviewApp;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import androidx.core.app.NotificationCompat;
public class SmsListenerService extends Service {
private static final String TAG = "SmsService";
private SmsReceiver smsReceiver;
private static final int NOTIFICATION_ID = 123;
@Override
public void onCreate() {
super.onCreate();
smsReceiver = new SmsReceiver();
IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
registerReceiver(smsReceiver, filter);
startForeground(NOTIFICATION_ID, createNotification());
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// Service logic goes here
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(smsReceiver);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
private Notification createNotification() {
// Create a notification for the foreground service
// Customize this method to create a notification that suits your app
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "channel")
.setContentTitle("text")
.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentText("text")
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
Notification notification = builder.build();
Log.i(TAG,"notification " + notification);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notification);
return notification;
}
public class SmsReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus");
if (pdus != null) {
for (Object pdu : pdus) {
}
}
}
}
}
}
I tried using something other than telephony.
but I still get the telephony error :/
the same thing.
but pay attention to my important note up there, I think the problem is something external.
because I am Sure that my project ran smoothly yesterday. (I changed nothing)
from telephony.
I'm facing the same crash. Linking some relevant data below
Stack trace
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.shounakmulay.telephony.sms.IncomingSmsReceiver: java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.view.FlutterCallbackInformation.callbackLibraryPath' on a null object reference in method 'java.lang.String io.flutter.embedding.engine.dart.DartExecutor$DartCallback.toString()'
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4903)
at android.app.ActivityThread.-$$Nest$mhandleReceiver()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2420)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8779)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Relevant code snippet
@pragma('vm:entry-point')
backgroundMessageHandler(message) async {
String? smsUrl;
String? env = await PreferencesHelper.prefGetString(PreferencesHelper.env);
try {
smsUrl =
(await PreferencesHelper.prefGetString(PreferencesHelper.ingestUrl)) +
Endpoints.ingestSms;
} catch (e, s) {
debugPrint('Error in bg msg handler: $e');
debugPrintStack(stackTrace: s);
}
syncSmsPeriodic(
smsUrl, env);
}
@pragma('vm:entry-point')
registerBgSmsListener() async {
await PreferencesHelper.prefSetString(PreferencesHelper.ingestUrl, ingestUrl);
final Telephony telephony = Telephony.instance;
telephony.listenIncomingSms(
onNewMessage: (message) {
backgroundMessageHandler(message);
},
onBackgroundMessage: backgroundMessageHandler);
}
Crashlytics stats of my app
from telephony.
Related Issues (20)
- Not work at background HOT 2
- Lost spaces and newlines in the middle of long SMS
- Fail to send SMS (SmsManager problem) HOT 4
- [BUG] IncomingSmsReceiver listening even when instance is not created leading to crashing of app when a background notification recieves HOT 1
- Not listed SIM 2 sms in list
- Help request HOT 2
- How to navigate to a screen/page from the onBackgroundMessage(SmsMessage message) method
- feedback about foreground background instance HOT 1
- how to fill it in OTPField ? can you create example
- How to get the SMS sent by the user??
- backgrounMessageHandler or backgroundMessageHandler?
- Google messaging App is a problem for capturing SMS by Telephony HOT 1
- Keeps crashing in background HOT 4
- how to stop listening after collecting my sms
- No implementation requestPhoneAndSmsPermissions
- Unhandled Exception: NoSuchMethodError: The getter 'requestPhoneAndSmsPermissions' was called on null. HOT 1
- Unwanted logs in console. HOT 3
- is there a way that i can get the imsi code ?
- Message sending issue
- iOS support for `Sending` SMS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telephony.