让我开始解释我的问题。有一些解释的存储库,但没有方法如何从 Meteor 服务器获取集合或 json 文件(仅插入)。作者也没有正确解释 onDataChanged、onDataAdded 等方法。
public class Login extends Activity implements MeteorCallback{
public static Meteor mMeteor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mMeteor = new Meteor(this, "some_socket_it_doesn't_matter");
mMeteor.setCallback(this);
}
}
public class ListOfElements extends ListFragment implements MeteorCallback{
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
String subscriptionId = Login.mMeteor.subscribe("notifications");
Log.d("Log", subscriptionId);
}
}
我不明白我必须如何使用订阅或如何从服务器获取集合。为什么github仓库里只有insert方法,没有get方法?我真的不知道如何制作代码来获取收藏、使用订阅等。网络中没有任何可以理解的解释。请您通过解释如何实现获取,订阅此代码来帮助我。