Android: Not Able to display Offerwall NativeX W3i - android

I am working on a game - it requires to implement offer-Wall.
The problem is from within the game I am not able to display the offer-Wall.
My game at the time of loading the splash makes some connections (login, creating sessions etc) with own game server. Once this is done im not able to display the offer-wall.
If I Comment the in-game server connections the offer-wall works good.
And the offe-rwall being used is NativeX (W3i earlier)
But I could display the same offer-wall correctly from another test App.
Seems like Once the game is connected to the game server, no other connections are alowed Or they are put on hold. Any help with this please.
Thanks in Advance.

The NativeX MonetizationSDK requires initialization on the UI Thread.
Make sure that after you are making the network calls to your server you get back on the UI Thread before initializing and calling the SDK.

Related

Android Chat with own resources / Pull data live from server

I started with a application where you can chat.
Now im in the position to start with the chat.
The problem I'm facing is that I don't want to use
resources from "outside". With outside I mean:
Firebase, Socket.io and so on.
I do simply rent a webspace. And I'm asking you now,
how is it possible to realize an live chat without
using extern services like firebase.
Is it possible with only using an Webspace?
What is required to make an live chat?
And there comes the second question:
How do I realize to stay connected to a server to check if there is a new message without using much battery or network ressources?
I'm not asking without hardly trying by my self.
Two days ago I started with the research of possibility, but I didn't found anything which would work I guess.
Thanks folks...
You need to connect to the Web Server using a Socket and keep that connection open to receive new messages with little delay (see for example http://srchea.com/build-a-real-time-application-using-html5-websockets) This keeps the phone active and uses much battery.
The very purpose of Firebase is to bundle this work for all services which need this type of communication (E-Mail, Push messages of newspapers, Chats) such that the phone only has to query one server. Therefore, I see no way for you to find another solution which uses little battery.

Google Play Services Real Time Multiplayer Message

im currently developing a multiplayer cardgame for android and i'd like to use the google game services realtime multiplayer api. From reading the documentation i know that in the end, every message a client receives will call the RealTimeMessageReceivedListener() . My question is, WHEN is the method called if my application is currently in a working state?
Cause currently i split the application in model view controller with the gui running in its own thread. The controller polls the gui for input and calls the model interface to change the data.
So if i run the multiplayer part in the controller thread, will my application flow just stop when the MessageReceiver is called, will do some stuff in it, and after that continue at its old position, like a software interrupt, or is the MessageReceiver call buffered and called after everything else finishes. If thats the case i guess i have to use a third thread.
Im currently working with libgdx, so no android specific stuff has been touched. Maybe someone combined libgdx with the multiplayer aspect of the goggle game services and can tell me more, cause currently im a little bit lost, on how to get these things together. I know there is tutorial out there for implementing the gameservices with libgdx, but its not touching the multiplayer part.
Thanks in advance.
I think you are asking which thread will the RealTimeMessageReceivedListener async callback run on. As far as I can tell, the callbacks will run on the main Android UI thread (*1). This thread is different from the Libgdx main UI thread (*2).
This means the Google Play Service callbacks can run independently of your main Libgdx logic. If you have your GPS callbacks use the Libgdx Application.postRunnable API, you can get your main Libgdx thread to deal with all the incoming changes serially with everything else (queued runnables are executed at the beginning of each render loop).
(*1) search for 'thread' in this Google Developers blog post. I couldn't find any better reference.
(*2) http://www.badlogicgames.com/forum/viewtopic.php?f=21&t=1298
This Listener listen to messages from the function sendReliableMessage
u can check all those send message here RealTimeMultiplater
u send the message to "Google" and it fowards to the other GoogleApiClients which exist in the same Room

Background Operation when the app is running

I was wondering if it is possible ( it should actually) to run a piece of code every couple of minutes even if the user is using the app. The basic Idea behind this is that the User will take the smart phone with my app loaded in the field and start collecting data, while he is collecting data or playing with other options of the app the phone catches the 3g/wifi zone it will start syncing the data to the server. I keep pushing notifications to the devices from my web service using Google Cloud messaging (GCM) and when it reaches the phone it means the phone is now connected to the internet I run that piece of code which do the sync for me. Would it stop the current activity of the app or I would say do the user will be able to keep collecting data and the sync is also running on the background?. any idea of this type of scenario?
thanks guys.
Anything that communicates with a server is by nature asynchronous in ActionScript (and you can't make it synchronous). So just do what you'd normally do to communicate with the server. Other processing, such as loops over a large collection or drawing a lot of objects, can make the application unresponsive.
Yes it is possible using AsyncTask. And your application will not stop while AsyncTask is running in background.

How to test android app web service calls with robotium?

I have developed an android app on which i want to run the robotium test cases. The first problem i have is, In my app i am using so many web service calls to interact with the server, Whenever the app hits the server i am displaying a progress dialog, Now i want to make wait the robotium until the app get response from the server but i can make wait for some time using waitForDialogToClose(), Actually i want to make it wait exactly till it get some response or error from the server. How to do it..??
And the Second problem is i am doing some uploading data(eg. file or image) to server and i am displaying progress bar for it, In this case i want to make wait robotium until my progress bar reaches it max value. Please help..
Regards,
Ram.
Robotium is a black box testing framework : you test an app from the UI layer and it can even run without any knowledge of the code of the app under test.
For this reason, from robotium you can't plug a listener in your model or rest client and wait till the response comes into your app. So, you have two options :
relaying on the UI as you do, waiting for a given state to appear in the UI, as you suggested with a dialog, or the content of a list, whatever.
wait for some time before continuing the test, a time at which you are pretty sure data will be there. But this is more risky and will fail more often.
Some unit tests would be nice to test your rest client (or equivalent), then if you could mock it and run your ui tests disconnected it would be nicer. But all this require a large amount of design work, worth it but complex for a small app and a beginner in java. Maybe you would be better testing only your UI and keeping in mind that your tests are not perfect.

Design and logic for client/server networking games

I am creating a simple android game that deals with multiplayer and connecting to server. This is what I want to achieve for my game.
Client sends keystroke movement to server.
Server accepts input, update the state and calculates and returns new position to client
Client gets new position and update the screen.
I already have some code written and so my one of my threads sends keystroke to server, waits for the new position, then update the screen. The thing is there is lag between the player's movement. I think it has to do with latency. I also tried two thread, one for sending/receiving data from server and another is updating the screen. But it didnt' solve my latency problem.
Can anyone suggest a good design for networking game?
Do I need to do early prediction?
Do I need separate thread for fetching data and rendering screen?
P.S.This is my first time creating a network game so i have no idea what im doing.
The structure I prefer to use is to have one thread updating graphics and logic on the client side, and then one thread receiving and sending data to the server. If you have problems with latency, there is a magic option which might solve it if you want data to be sent continously. (at least this is the syntax if you are using java)
mySocket.setTcpNoDelay(true);
This option solved my latency issues when I sent real-time coordinates over a network.
Edit: I think TCP by default waits and bunches together data before sending it, which could be a problem if you want to send small updates fast.

Categories

Resources