How to fetch getOnlineUsers() ????

0 votes

Hi Shephertz,

 

I m trying to fetch all online players using getOnlineUsers() mehod, but after tring from last two days, didnt get any result, i have authenticated user using app42 cloud api, this is android projects and using both Appwarp and App42cloud api.

please check this code which i wrote:

 

UserList.java

 

package com.shiv.onlineplayers;
 
import java.util.ArrayList;
 
 
import com.shephertz.app42.gaming.multiplayer.client.WarpClient;
import com.shephertz.app42.gaming.multiplayer.client.command.WarpResponseResultCode;
import com.shephertz.app42.gaming.multiplayer.client.events.AllRoomsEvent;
import com.shephertz.app42.gaming.multiplayer.client.events.AllUsersEvent;
import com.shephertz.app42.gaming.multiplayer.client.events.LiveUserInfoEvent;
import com.shephertz.app42.gaming.multiplayer.client.events.RoomEvent;
import com.shephertz.app42.gaming.multiplayer.client.listener.ZoneRequestListener;
 
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
 
public class UserList extends ActionBarActivity implements ZoneRequestListener{
 
Handler UIThreadHandler = new Handler();
private ProgressDialog progressDialog;
private ArrayList<String> userList = new ArrayList<String>();
 
public void onCreate(Bundle savedInstanceState) {
 
super.onCreate(savedInstanceState);
        setContentView(R.layout.user_list);
 
        AsyncApp42ServiceApi.getMyWarpClient().addZoneRequestListener(this);
        AsyncApp42ServiceApi.getMyWarpClient().getOnlineUsers();
        
}
 
@Override
public void onCreateRoomDone(RoomEvent arg0) {
// TODO Auto-generated method stub
 
}
 
@Override
public void onDeleteRoomDone(RoomEvent arg0) {
// TODO Auto-generated method stub
 
}
 
@Override
public void onGetAllRoomsDone(AllRoomsEvent arg0) {
// TODO Auto-generated method stub
 
}
 
@Override
public void onGetLiveUserInfoDone(LiveUserInfoEvent arg0) {
// TODO Auto-generated method stub
 
}
 
@Override
public void onGetOnlineUsersDone(AllUsersEvent arg0) {
 
if(arg0.getResult() == WarpResponseResultCode.SUCCESS){
 
AsyncApp42ServiceApi.getMyWarpClient().getOnlineUsers();
 
 
}
 
}
 
@Override
public void onSetCustomUserDataDone(LiveUserInfoEvent arg0) {
// TODO Auto-generated method stub
 
}
 
 
}
 
 
Please let me know how to fetch..
 
Thanks.
asked Oct 17, 2014 in AppWarp by shivdataservices (30 points)

1 Answer

0 votes
Hi,

Are you getting any error code in listener?

Which sdk version you are using?

In addition App42 and AppWarp are different products,There is no relation between them.

Below are the recommended steps for your trask

1 .Initialize the WarpClient using Apikey and Secret key
 WarpClient.initialize("<Api_Key>", "<Secret_Key>");

2.Add listeners

3.Connect to AppWarp server with username
  theClient.connectWithUserName(localUsername);

4.Call Api
theClient.GetOnlineUsers().

You can find the complete sample from below link
https://github.com/shephertz/AppWarp_JAVA_SDK_JAR/tree/master/Sample
answered Oct 17, 2014 by errahulpanchal (169 points)
Hi Rahul, i m not getting any error, but only online userlist is not fetching. showing only blank screen. while, i m using two emulaters.

I am using this following versions:

App42 cloud Api - V.2.9
AppWarp - V. 1.5.5
Android Min Sdk - 2.3.3 max. 5.0

Yes, i know App42 & Appwarp both are different products, actually my project based on both api's, while user install an app i m showing create/authenticate user screen, based on app42, then after signin/signup, user lands on page where i want to show him all online players available that moment to play. & in future i also want to use Leaderboard, Achievement etc. App42 services in my same app.

Here i did not connect appwarp server using Username, i have implemented login/signup screen which is based on App42.

while creating app on AppHQ, i have created my app using Appwarp so, i can use both, app42 and appwarp api together, as per shephertz docs.

Please let me know, this is right way to use api's.
I appreciate your reply, thanks.
You can use App42 and Appwarp simultaneously but you have to connect appwarp server separately using username. AppWarp maintains one time session for user,so whenever user starts the app,it needs to call connect with username.

Please use out latest sdk from below link
https://github.com/shephertz/AppWarp_JAVA_SDK_JAR/tree/master/V_1.10

GetOnlineUsers() is working fine in below sample
https://github.com/shephertz/AppWarp_JAVA_SDK_JAR/tree/master/Sample
Rahul, Thanks for your reply. SDK Link you provided which is not compatible to my development, i am developing with Android not Java, after i have downloaded latest Android SDK from your appwarp site but facing same problem, and unable to fetch online users, can u please resolve this problem with any short example.

Thanks.
Hi,

Since Android's runtime is based on Java, our Java SDK works on Android too. Even if you download the SDK from our site for Android, it's the same java SDK. And all our Android samples uses it too.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...