greenrobot-eventbus

How to receive eventbus events when Activity is in the background

浪尽此生 提交于 2019-12-07 23:48:58
问题 I want to get notification message using Firebase Notification service. I'm sending message from Firebase, it is ok. I want to get this notification if user run in MainActivity also I want to show pop-up using dialog. If user run other activities for example SettingActivity or ProfileActivity , notification handle anyway and user run MainActivity pop-up appear suddenly. To do this I'm using Greenbot Eventbus. When I'm inside MainActivity and notification comes It appears so it is ok. But When

Difficulty in understanding complex multi threading in Android app

丶灬走出姿态 提交于 2019-12-07 13:39:59
问题 I have big problem with understanding multi threading in my application and because of that finding a bug. I've checked I think all possibilities and still I am getting various (sometimes unexpected) errors. Maybe someone here will be able to advice me, what I should do. In my project I am using two external libraries: GraphView - provides views for graph drawing EventBus - provides interface for easy communication between app components As for the app it has the structure like this:

How to post a message from a background service to a UI fragment?

自作多情 提交于 2019-12-07 08:15:21
问题 I have an issue with EventBus from Greenrobot. I was trying to post an event from a background service form my sync adapter and catch it in a fragment to update the UI. The problem is that when I try to post the event from sync adapter I have get the following in the debug log: No subscribers registered for event class olexiimuraviov.ua.simplerssreader.event.UpdateUIEvent No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent I register fragment in onResume and

How to receive eventbus events when Activity is in the background

喜夏-厌秋 提交于 2019-12-06 10:55:27
I want to get notification message using Firebase Notification service. I'm sending message from Firebase, it is ok. I want to get this notification if user run in MainActivity also I want to show pop-up using dialog. If user run other activities for example SettingActivity or ProfileActivity , notification handle anyway and user run MainActivity pop-up appear suddenly. To do this I'm using Greenbot Eventbus. When I'm inside MainActivity and notification comes It appears so it is ok. But When I'm inside another Activity notification not coming. How to handle this message until come

How to use GreenRobot's EventBus in broadcasting events from Service to Activity?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 07:14:44
Recently I became aware of EventBus Library. Basically my use case revolves around a service and an Activity. Service is used for tracking the changes in the BLE connection. Activity is used for reporting that connection state to the UI. How can I achieve the same using the library.. In your Activity's onResume method, register for events: EventBus.getDefault().register(this); And unregister at onPause EventBus.getDefault().unregister(this); When service is running and it obtains info regarding BLE, send this info through EventBus: BLEInfo bleInfo = new BLEInfo(... // create some kind of

Difficulty in understanding complex multi threading in Android app

给你一囗甜甜゛ 提交于 2019-12-05 22:38:00
I have big problem with understanding multi threading in my application and because of that finding a bug. I've checked I think all possibilities and still I am getting various (sometimes unexpected) errors. Maybe someone here will be able to advice me, what I should do. In my project I am using two external libraries: GraphView - provides views for graph drawing EventBus - provides interface for easy communication between app components As for the app it has the structure like this: MainActivity / \ / \ Thread Fragment (ProcessThread) (GraphFragment) The idea is that ProcessThread computes

How to post a message from a background service to a UI fragment?

本秂侑毒 提交于 2019-12-05 13:53:27
I have an issue with EventBus from Greenrobot. I was trying to post an event from a background service form my sync adapter and catch it in a fragment to update the UI. The problem is that when I try to post the event from sync adapter I have get the following in the debug log: No subscribers registered for event class olexiimuraviov.ua.simplerssreader.event.UpdateUIEvent No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent I register fragment in onResume and unregister it in onPause @Override public void onResume() { super.onResume(); EventBus.getDefault()

Kotlin: Can we use @Subscribe of EventBus (GreenRobot) in Kotlin?

风格不统一 提交于 2019-12-05 03:51:21
My onEvent in a fragment as below, capturing the authentication of the activity, in my Kotlin function. However, I can't get that onEvent triggered. @Subscribe fun onEvent(event: AuthenticationEvent) { if (event.isAuthenticated) { startFragment(signInFragment, SignInFragment.TAG) } else { startFragment(signOutFragment, SignOutFragment.TAG) } } In my build.gradle file, I have add this compile 'org.greenrobot:eventbus:3.0.0' Is there anything I need to do to get this trigger? To use annotation processors with Kotlin, you need to use the Kotlin Annotation Processor tool (kapt) . Add this to your

EventBus, register and registerSticky method

烈酒焚心 提交于 2019-12-04 23:15:58
I use greenrobot EventBus library to send data between two fragments in my android app and I want to know what is the diffeence between register(Object b) method and registerSticky(Object object) method? EventBus allows you to post events that are "sticky" and by that EventBus understands events that "stick to the eventbus" for future access. If you post a normal event when there are no subscribers registered at the moment of sending, this event will be discarded. You can post a sticky event though, even if there are no subscribers to receive that at the moment, and it won't be discarded

EventBus - Subscriber class and its super classes have no public methods with the @subscribe annotation

て烟熏妆下的殇ゞ 提交于 2019-12-04 08:51:54
问题 I'm creating an Android application using EventBus for posting asynchronous broadcasts to other classes, but I'm running into an error during execution. MainActivity.java import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.gms.maps.model.LatLng; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe;