Rare RuntimeException when creating notification

I have a GcmListenerService that listens for GCM messages and then creates a notification:

  public class MyGcmListenerService extends GcmListenerService { NotificationManager notificationManager; @Override public void onMessageReceived(final String from, final Bundle data) { super.onMessageReceived(from, data); notificationManager = (NotificationManager) getApplicationContext().getSystemService(NOTIFICATION_SERVICE); String title = data.getString("title"); String messager = data.getString("message"); Notification notification = new NotificationCompat.Builder(getApplicationContext()) // set title, message, style etc .build(); notificationManager.notify(0, notification); } } 

Everything is very standard. This works several thousand times a day for thousands of users. I do, although through Crashlytics they get a couple of the following crashes for the above line:

Fatal Exception: java.lang.RuntimeException Unable to create an internal thread handler that did not call Looper.prepare ()

This happens almost exclusively on Android 6 (98%) and manufacturer’s devices called TCLCommunications.

Has someone already experienced something similar or have an idea of ​​what this means?

It should be perfectly fine to create a notification from the background thread, right?

+5
source share

Source: https://habr.com/ru/post/1262293/


All Articles