Hello,
I am developing an Application for Windows Phone and Windows 8.1 using the Windows Runtime using the AppWarp SDK and App42 Cloud SDK and for some reason after I make my initial connect call in AppWarp and receive my onConnectDone successfully after a short period of time I get another call to onConnectDone with an error code. What I basically have set up is the following scenario:
-
The user opens the app to the LoginPage.xaml with fields for username and password and the app sets up my App42 Services
-
The user enters the username and password and hits Login
-
This calls my App42 Authenticate() with the given username and password and an instance of the LoginPage
-
The Authenticate Callback is then called and if it is successful I call the App42 GetSession() with the same instance of the LoginPage
-
When the GetSession() callback is received successfully I then move to the next page LoginPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>. {Frame.Navigate(typeof(MainPage))});
-
In the NavigationHelper_LoadState of MainPage I check if my warpClient is null and initialize it and GetInstance() and then setup all the required Listeners and then call Connect()
-
I get the OnConnectDone callback successfully and then from this callback I call the App42 GetAllFriends() and App42 GetFriendRequest()
-
I get the GetAllFriends callback successfully and from this callback I call GetSession(false) for every friend in the List<Buddy> response to check if they are currently online.
-
When I get the GetFriendRequest callback successfully I return and do nothing.
The problem is between 6 and 9 my code keeps calling the OnConnectDone() many times (I've set a breakpoint on this function while debugging to check) and I end up with an warpClient that no longer has a valid connection for some reason. I am not sure what is going on but I believe it has something to do with strange threading behavior that I am unaware of. I've set a breakpoing on the warpClient.Connect() call and it is only run once so I really can't figure out what is going on. Any ideas?
UPDATE: Okay so I have commented out everything after step 6 and have it set so the LoginPage does nothing but simply call Frame.Navigate(typeof(MainPage)) when a button is clicked and I put breakpoints on every class and method and function call and the warpClient.connect() is only called once like it is supposed to when the page is loaded but I am getting two callbacks to OnConnectDone() and the second time has a result code of 6 which is supposed to be a network error. I really have no idea what is happening.
I know the AppWarp WinRT SDK was just released so is this possibly a bug?
UPDATE 2: Okay looking at the call stack when the 2nd onConnectDone is called I see a lot of references to keep alive timer expiring. Am I required to set a keep alive timer to a value every time I connect to AppWarp? I thought this was only required to recover dropped connections, does this mean my connection is dropping?
UPDATE 3: Okay so it seems that for some reason my connection keeps failing and the onConnectDone is trying to recover the connection so I set up a recovery allowance of 2 minutes and I handle the recoverable connection response code in my onConnectDone() but my connection just keeps on dropping and then I recover over and over. My internet connection is fine and all the internet functions are still working on my device. Any ideas what is happening?
I've also noticed that the connction quite frequently drops when I interact with the screen in some way.