将事件监听器添加到特定的Activity



在我的GcmIntentService中收到一个GCM Intent后,我正在构建一个推送通知,我必须将一个特定的Activity设置为EventListener。

public class GcmIntentService extends IntentService {
    @Override
    protected void onHandleIntent(final Intent intent) {
        //This code gets triggered, what to add here 
        // to make SomeActivity's onEvent get triggered
    }
}

public interface EventListener {
    int onEvent(Event event);
}
public class SomeActivity extends Activity implements EventListener {
    @Override
    public int onEvent(Event event) {
    }
}

检查这些活动监听器-谷歌云消息- BroadcastReceiverhttps://commonsware.com/blog/2010/08/11/activity-notification-ordered-broadcast.html

相关内容

  • 没有找到相关文章

最新更新