@Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        add MQTT listener
        MqttService.add_mqttListener(this);
//        need to bind the UI activity and the background service
        Intent intent=new Intent(getActivity(),MqttService.class);
//        change the current msg-->different page has different topic
//        TODO: may use '#' to receive all msg, and different listener to select the topic they need
        MqttService.setCur_topic("pic_data");
//        TODO: this function is only used for >=API 8.0, so may be need to support other version's API
        startForegroundService(getActivity(),intent);
    }
@Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MqttService.add_mqttListener(this);
        Intent intent=new Intent(getActivity(),MqttService.class);
        MqttService.setCur_topic("pic_data");
        startForegroundService(getActivity(),intent);
    }
@override public void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); mqttservice.add_mqttlistener(this); intent intent=new intent(getactivity(),mqttservice.class); mqttservice.setcur_topic("pic_data"); startforegroundservice(getactivity(),intent); }