Giter Site home page Giter Site logo

Comments (111)

fda77 avatar fda77 commented on June 4, 2024

dislike! i've signed up..

from andlytics.

AndyScherzinger avatar AndyScherzinger commented on June 4, 2024

I also signed up with a dev account, not the one I use for tracking apps

from andlytics.

8p8web avatar 8p8web commented on June 4, 2024

cross your fingers and hope the new console will have stable APIs for us!

from andlytics.

DieBagger avatar DieBagger commented on June 4, 2024

Did you try to get a question submitted at google i/o? Might be a good way to reach someone at google that has the pull to make an api happen...

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

So I have a 'Try the new design link' here goes nothing.....

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

So first thing, you can run them side by side, and on the website you can switch between the two so Andlytics works fine using the old system. That is where the good news ends, it appears to be quite different both in terms of how it is presented (split up so no stats overview on the home screen), and internall how it is sent. Although I don't know enough to really work with it.

Anyone else have access yet?

from andlytics.

AndyScherzinger avatar AndyScherzinger commented on June 4, 2024

Not yet :-(

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've started making some notes on it here https://github.com/AndlyticsProject/andlytics/wiki/Developer-Console-v2

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've added a good first pass at the basic structure. Biggest problem is lack of totals in an overview, so will have to request the full stats (full history), just to get the current data for total/active installs. However, we could then use that to provide the full data to users...
We will also have to request the ratings and the full comments.

I'll setup a new branch for it soonish as it will require lots of help while being worked on. We have no timeframe from google, so ASAP is probably best.

from andlytics.

AndyScherzinger avatar AndyScherzinger commented on June 4, 2024

Sounds like a plan to me!

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

I don't have to the actual console, but from you wiki info, it seems the responses are much better structured than the current ones. Maybe they are moving away from GWT which seems to be a general trend for Google.
In any case, this should make it easier to work with.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Yes it does look much better. There also seams less scope for playing around with it and breaking it (although they could make a massive change and really break it). Can someone with a multiconnected developer console give me some input once you get access. When requesting apps using:

Request: POST https://play.google.com/apps/publish/v2/androidapps?dev_acc=DEV_ACCOUNT_ID

Payload: {"method":"fetch","params":[,,1,1],"xsrf":"XSRF_TOKEN"}

I have a feeling that one of these values out of "params":[,,1,1] will switch consoles.

General question, can we automate (use a parsing library), these JSON responses? I've only worked with fully formed responses using keys. (I can provide full example responses for thoses without access but who are good with this stuff)

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

It can probably be done with Gson, but if you don't now the actual format, pre-defined parsing might throw if it sees something it doesn't know about. Pulling only the stuff we need/know about might be more reliable in practice.

http://code.google.com/p/google-gson/

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Well that is what I was wondering, I've used Gson before, and I know you can either get it to map it all to a class, and can also grab specific things, which is what we want. But how do you do it when you want the 5th entry in a three level deep array without any keys.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Login process has changed now, appears to be a chain of requests but I cannot work out where the cookie ANDROID_DEV is coming from.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Branch with a start although none of it works as I cannot get past the login (hopefully I'm missing something obvious) https://github.com/AndlyticsProject/andlytics/tree/dev-console-v2 (its setup in a way so you can still use the app though, its just that refreshes are a bit slower)

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Not having much luck with Gson while trying to parse ratings (the simplest).

{"result":[null,[[null,"com.serviidroid","2","0","3","27","206"]]],"xsrf":"AMtNNDEnXXXXXXXXXXXXXX:123456789"}

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Wiki has even more info now, the two seperate things that need to be solved:

  1. How to get the missing login information and the potentially other missing info (Part of general communication re-write).
  2. Is there an automated way to parse responses using Gson etc, so far I haven't been able to get it to play nice (Part of new parsing re-write).

These can be worked on seperately, so if you are a JSON expert then I can give you example responses to work with even if you don't have access. If you are a web expert and want to help with general http communication work, then you will need to wait until you have access.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

What exactly is the problem with Gson? BTW, don't know on what basis access to the new console is given, maybe location? I registered ages ago (at Google I/O) and still nothing. Some people got it after a few days, other are starting to get access now.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I guess it is ramped up quota per location.

Well using ratings as an example, this is what is returned:

{"result":[null,[[null,"com.serviidroid","2","0","3","27","206"]]],"xsrf":"AMtNNDEnXXXXXXXXXXXXXX:123456789"}

Whenever I try to get Gson to read it, it throws an illegal state exception beceause of the lack of names I guess. I've tried parsing it into a Map<String,String> (which should contain an entry for result and and entry for xsrf, you would then expand on the result one), but it doesn't like that either.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Maybe it's all those null's. There was some way to have a custom null representation, I'll have to check.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I thought it was OK to have null. Anyway if you work out how to parse that simple one that would be great,

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

This seems to work, with or with serializeNulls().

static class Foo {
  List<List<List<String>>> result;
  String xsrf;
}

Gson gson = new GsonBuilder().create();
String json = "{\"result\":[null,[[null,\"com.serviidroid\",\"2\",\"0\",\"3\",\"27\",\"206\"]]],\"xsrf\":\"AMtNNDEnXXXXXXXXXXXXXX:123456789\"}";

Foo f = gson.fromJson(json, Foo.class);
System.out.println(f);
if (f != null) {
    System.out.println("f.result: " + f.result);
    System.out.println("f.xsrf: " + f.xsrf);
}

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Hmmm I tried something very very similar to that. Thanks for the pointer. So you would then do?

List<String> values = f.result.get(1).get(0);
int num1Stars = Integer.parseInt(values.get(2));
etc...

I've got to go to work now, I'll have a go at this for the rest of them later on.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

It's actually at idx 1, but something like this, yes:

List<String> values = f.result.get(1).get(0);
int num1Stars = Integer.parseInt(values.get(2));

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Yeah I realised that after double checking. Some of the more complex ones are going to be painful...

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

So maybe using JSONObject directly without a full mapping might be easier? You don't have to map/name the ones you don't know/care about:

JSONObject j = new JSONObject(json);
int num1Stars = j.getJSONArray("result").getJSONArray(1)
                    .getJSONArray(0).getInt(2);

BTW, I think Gson has a similar mode in latest version too.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Could be, i'll work on this tonight and commit what I can including sample responses for testing.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

That works very nicely, parsed the app data json structure in ~15 lines of code - this should be alot cleaner than the messy GWT stuff :), although I think it will require more requests :(. I'll write the rest of them later today and then commit it. There is a sepeation on the site for the number of apps, I have page 1 of 1 displayed, so the data may get split if there are lots of apps. I belive @devwom has 14 apps - if so can you chime in once you have access.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Just commited code that is able to parse all of the incoming data (in the same way as before, it doesn't use any historical or dimentional data just yet). The only thing on the parsing side is to properly account for draft apps, check if we need to do something when the user has a lot of apps, and work out how to parse the new date format that google is using e.g. 1343652956570. So the big thing left to do is the login process.

3dd7a33

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Nice to hear. I'll have a look later. As for the date, it's a Unix timestamp (milliseconds since Jan 1st 1970), so all you need is:

long timestamp = 1343652956570L;
System.out.println(new Date(timestamp));

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Not sure how I missed that :(

One question for those not in the UK, how do the dates for your comments appear. At the moment it stores them in the db in a string pre-formatted e.g. 'Tuesday, 7 Aug 2012' I guess it would be better to store an unformatted version to let us then format it to the usres locale?

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

There is only one right way to do it :) Store UTC timestamps (int) and format as necessary when displaying. That is the 'native' timestamp format of SQLite as well.

At least for comments, dates are shown in the native locale format. The 'last update' at the bottom seems to be fixed at 'yyyy-MM-dd HH:mm:ss'. Any other screens that show dates?

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Just checked the code inside GwtParser and it pre-formats them straight after parsing and then uses that string representation throughout.

String dateString = DateFormat.format("EEEEE, d MMM yyyy", date).toString();
comment.setDate(dateString);

Whereas the last update is stored as a Date in memory, but formatted using:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

When displayed and stored int he db.

Graphs have dates but can be configured, however they are also a Date in memory but stored as yyyy-MM-dd HH:mm:ss in the db.

What would be the best way to deal with upgrading the db though?

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

It seems SQLite can handle date strings automatically as well, and since the actual time is only displayed for the last update, this might not be much of a problem after all. "yyyy-MM-dd HH:mm:ss" is still OK, we just need to make sure the time zone is consistent (local or UTC).

http://www.sqlite.org/datatype3.html

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've just been debugging the code, and it appears to wipe out the comments table on each refresh of the comments (loads in blocks and clears the table when loading the first block). So that could probably be improved on, but would facilitate easy migration from the current pre-formatted version to yyyy-MM-dd HH:mm:ss or int.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've changed comments to use yyyy-MM-dd HH:mm:ss so it is at least consistant now. We can revisit it if needed if we decide to use the historical data, for now it should be fine. Back to trying to revese engineer the login process...

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

For the login part, what does your browser do? What happens when follow the redirects (status 302)? This is rather comment with OpenID or OAuth-style authentication where the site that authenticates you is different from the target site.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've put everything that looked relivent to the login on the wiki (as far I can see). It follows the two 302 redirects getting the AD cookie then the devacc. On the 3rd request which is the main url containing devacc which we see in our browser, it gets the xsrfToken from the entity and then starts requesting data.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Well, something is obviously missing :) What happens if you send exactly the same requests using HttpClient (including headers, client agent, parameters, etc.)? If it is blocking/filtering you out it could be either by client agent or IP. They probably won't filter by IP unless you send way too many requests, so that leaves User-agent and maybe some other headers. Or maybe the auth token you are sending it not the proper one? The current client uses ClientLogin, the new one might be using OAuth2. How do the Authorization headers look like?

If you could post a full wire dump somewhere, we might be able to figure something out.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Will do a bit later on today. I've tried doing parts of it in my browser by copying all the headers but it doesn't work. It uses the same url to get the authToken as the old version, although the old version now has some additional steps compared to the code to get all the needed variables so either it had a short version which is still supported, or there is a trick in the code for v1 to follow the redirects automatically.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Any suggestions for the filters for wireshark, I think i've got the minimal amount by just capturing tcp port 443, but it is just over 1000 packets which seems quite a bit, not really sure where to start with looking at it. Also not sure what help it will be if it is all encrypted, wouldn't a full trace from the browser with a dump of all the headers be more useful.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've writen up an extended version of the 4 requests used to get the AUTH_TOKEN (the part we should skip), and the first request done using the AUTH_TOKEN (which is where we should start).

https://github.com/AndlyticsProject/andlytics/wiki/Developer-Console-v2---Login-Process

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

You can't directly use wireshark for this, unless you have the private keys of the Google servers involved. You can use a proxy such as burp that will essentially pretend to be Google and decrypt traffic for your.

Might be a bit easier with Chrome's developer tools or Firefox's Web Developer or similar extension. I will check the Login-Process in detail tomorrow, but are you sure the 'auth' parameter in Request 5 is the same as the ClientLogin token you get from AccountManager? This is not apparent from the wiredump?

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I didn't think so, but wasn't really sure what to do.

I've been using Firefox's dev tools as Chrome's one didn't have the same level of detail in terms of sent cookies. Thats how I got the info on the wiki pages.

Hmmm not sure now, the token used in the v1 and v2 login via my browser is 205 chars, but the one given by AccountManager is 290. But then if it works with the v1 login using AccountManager, why wouldn't it for v2 if they use the same form via the web browser.

I'm not sure how to test this, because if I try to send the same request my browser made, I get what I think is a request to re-authenticate, so either I'm not sending it correctly, or they are one time tokens during the authentication process that you cannot reuse.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Request 1 should have an 'Auth long_client_login_token' or similar line in the response body. If that value is the same as the 'auth' parameter in Request 5, we can use AccountManger directly. However in that case all the intermediate requests would be unneeded, which is a bit doubtful.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Response body of request 1 is empty.

I've just found the AUTH_TOKEN in the response body of request 2 (which is referenced by the location from request 1):

 <head>
  <title>Google Accounts</title>
  <meta http-equiv="refresh" content="4;url=https://play.google.com/apps/publish/v2/?auth=AUTH_TOKEN"></meta>
  </head>

from andlytics.

fda77 avatar fda77 commented on June 4, 2024

I have found some screenshots of v2: http://www.androider.de/bilder-der-neuen-developer-console/94218893/

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I'm very busy at the moment with work and various other personal things. However, I though id post to say that google has just updated the v2 console to include active installs, average rating, and number of ratings on the overview page so that will eliminate the need to query ratings, but we will still need to queury stats to get downloads and reviews to get the comments. Its a step in the right direction though, hopefully they might add more data to the overview.

Has anyone else got access yet?

EDIT: actually we will need to query ratings as we need it broken down, so no change to us just yet.

from andlytics.

gpant avatar gpant commented on June 4, 2024

Hi, I have access to v2 for quite some time now, if you need any help in testing etc I can help

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Well I wrote the code to parse the new data format a while ago so that side of it is mostly done (need to handle draft apps with partial data as that is now allowed). What isn't working is authentication. I've documented the steps that my browser uses, and tried adapting the existing code/comparing it to the existing authentication process, but couldn't get it to work (fails to get the first cookie needed). If you have any experience in that area then have a poke around the dev-console-v2 branch, but otherwise it isn't ready for testing yet. I should be free again in a month, at which point i'll have another go at it if someone else hasn't managed it by then.

from andlytics.

AndyScherzinger avatar AndyScherzinger commented on June 4, 2024

Unfortunately I am still waiting for v2, sorry...

from andlytics.

arturdryomov avatar arturdryomov commented on June 4, 2024

Today a new developer console became available for everyone.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Was just about to post. I might have some time this weekend to work on it. By the looks of it we will still have a little while before its finished and the shutdown the old one.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

There are a lot of 'under construction' features, some of them major ones (like multiple APK support), so it might be a while. I'll try to look into the authentication stuff. It does look better, still not sure if it is more usable though. It doesn't show total installs and number of comments in the overview and there are other annoying bits like having to click twice to get to the merchant console, which should be integrated in the first place.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Nothing definitive yet, but it seems it is checking additional cookies you get when you through https://www.google.com/accounts/ServiceLoginAuth to authenticate. Those are not fixed, so it might be possible to do it using the AccountManager token (i.e. without using the actual username and password). Which is annoying since it is still using ClientLogin tokens.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

The V1 is using the 'passive=true' while V2 uses 'passive=1209600' as a login parameter. This might have something to do with it, but there appears to be no documentation about this (naturally).

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

No real progress, but just a note: HttpClient follows redirects automatically be default, so checking for 302 in the current form won't work.

The only place where differnt Google login endpoints and private headers, parameters, etc. are somewhat documented is the Chromium browser source code.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I had tried turning off redirects but think I didn't bother committing anything as I didn't get any further.

Well that will at least be something I guess.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Since the AccountManager token route doesn't seem possible (for now), I've added an email/password based authenticator. This is obviously not ideal, but works. Also shuffled things around a bit, still WIP.

Didn't mean to push this directly, but it's merged now. Getting data still doesn't work, but it gets the cookie and XSRF from the first response.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Just had a look over your commits. Looks like a good plan. I'm sure its possible to get the AccountManager tokens to work.

What do you think is the best way to deal with the db schema being different between the two branches. I saw you updated the revision for dev, but then I would expect a FC at some point after switching between branches.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Getting stats almost work, although it is GCing like crazy because of the historical data. Will try to push it later tonight. I'm almost sure the tokens can work too, but without documentation don't know if we can make it work.

Re: the DB version, this is just a quick hack so that the app works when switching branches. Didn't mean to merge it.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Well we can now get active device installs from the main data fetch, rather than doing a second request with all the historical data for that, so that should be an improvement.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

@nelenkov I've commit the change to get active device installs from the main request

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I'll leave making any more changes for now as its a pain to merge conflicts. Let me know when its ready for testing.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

I won't be able to work any more on this at least until tomorrow night (some ~20 hours from now), so feel free to play with it. It's more at the 'it mostly works' than 'ready to test' phase though.

One thing I noted is that it seems the 'number of comments' value does not necessarily match the number of actual comments, so it might mean something else.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Hm, maybe just the displayed number of comments on the main screen is wrong for some reason.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Pressed the wrong button...

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

OK, I'll have a play around with it tonight or tomorrow morning (14 hours time for me).

Its the number of ratings, not the number of comments on the main screen, which I think is correct for me, although I'll double check.

What are the main things on the todo list, other than use the AccountManager?

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

OK, see what you mean about comment count

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Oh thats really lame, I hoped that by requesting the details for 1, or 0 comments, I could get the full comment count, turns out you cannot. I currently have 140 comments for an app, requesting 1 gave me a response saying I have 105 comments, requesting 100 gave me a response saying I had 139 comments etc...

Not sure what the sollution for that is, other than asking for comment 1, seeing how many there are -> x asking for comment x, seeing how many there are -> x etc...

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

So i've been having a play around and its working reasonably well, well done for getting the authentication working. I also connected the comment parsing code up (haven't commit it though see point 4 below) and that worked, including fetching comments in blocks.

These are the things I think need to be addressed:
*Use AccountManager
*Clean up POST requests
*Get the correct number of comments, without making to many requests (and without asking for all the comments)
*Make the authentication info resuable (i.e. for accessing comments later) by storing the authenticator and latest authInfo
*Exceptions - They are a mess, looking at the code for v1 some of them cannot even be thrown, but are mentioned all the way up to the base activity. We need to simplify them i.e. NetworkException (thrown when downloading data which results in failed to connect message) and InvalidJSONException (thrown during parsing which results in an cannot update at this time due to the 'api'). Should probably include the JSON response in the InvalidJSONException in the off chance that only some users have a problem.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Just saw this, shame I'll be at work at the time. I guess they wouldn't really want to answer our questions though. https://plus.google.com/u/0/115995639636688350464/posts/CU3EeXcYKcZ

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

I've submitted a question in moderator, please upvote it so it gets a better change at being considered > all.

https://www.google.com/moderator/#15/e=1fab6c&t=1fab6c.5f

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Or, if anyone can join live, please ask the question directly. I most probably won't be able to make it.

https://developers.google.com/live/shows/9777014/

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Re: the TODO list

Besides the points above, gzip encoding needs to be handled better. Right now it probably won't work on 2.1 and 2.2 (of course, we could drop support for those. This being a developer app, it can be expected that people have reasonably recent devices/OS). Reusing auth info is best done by simply using a shared HTTP client instance. I'll try to get this done and maybe revise how POSTs are done in the process. Sometime this week, hopefully.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

TODO (long-term?): consider a stream JSON parser, so we don't have to expand everything in memory.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Voted.

Stream JSON parser could help, especailly for the stats data that we download but then ignore.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I missed it, http://www.youtube.com/watch?v=MBNUVXXz6Cw&t=19m57s - sadly they ignored the AccountManager part of the question :(

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Ah well. Those hangouts are rarely helpful if you are trying to do something unorthodox, but it doesn't hurt to try.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Refactored a bit to make DevConsole2 a singleton.

The AuthInfo needs to be revised and there is the exceptions issue, but this close to what I had in mind.

BTW, any particular reason why JsonParser methods are protected static? Looks like they should be either public or package and the class needs a private constructor if it is to provide only a bunch of factory/parser methods. But maybe you had something else in mind?

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

DeveloperConsoleV2 cannot be singleton (at least for now), because an instance may be needed for background syncing for one account, while viewing another account. Ideally, while the app is running we want to hold onto the authentication info (tokens and means to get a new one) so that users can then fetch comments, maybe just use Application like it did with the xsrfToken etc..... But at the moment, other accounts can be background synced and the background sync always re-authenticates (even if it then gets a cached authtoken from AccountManager).

No, that was a mistake, either package, or just public will do. The methods in JSONParser are of little use outside of the console as you need json to use them, so I guess thats why I was restricting them.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Totally forgot about background sync. Probably because I never use it. I'll look into it then. Re-creating the whole thing is wasteful though, so maybe a map of account->dev console instance could be used.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

accountName->devConsole map sounds like a plan

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Had a very quick look over it earlier and it's looking good, hopefully will have a bit of free time tonight to do it properly.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I've had more on that I had hoped, but just to say thanks for the work, those recent commits look good.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

As you might have noticed, I've shuffled things quite a bit :) Here's a short summary, before I forget:

  • moved all console related stuff (exceptions, client, parsers, etc.) to a console package with sub-packages for v1 and v2
  • Renamed all related classes to DevConsole* for consistency and less typing
  • Made DevConsole an interface. With some extra work we might make the v1 client conform to it so it's easy to switch. Not sure if this is worth it though
  • Removed unused exceptions and added/renamed the rest like so (w/ intended usage as below, not necessarily true ATM):
    • DevConsoleException: superclass of all
    • AuthenticationException: for auth errors
    • DevConsoleProtocolException: for unexpected replies and unparseable JSON data. Can store request/reply strings.
    • MultiAccountException: it seems V1 throws this when it detects (how?) possible multiple accounts console (what is the actual problem again? can we support this in V2?)
    • NetworkException: a glorified IOException wrapper.
  • maybe broke something in the process...

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

All looks very sensible and along the lines of what I was thinking. Not sure if it is worth getting them to work side by side though as v1 will not work in the long run.

Re multi account, I think the server sends something back and the client then picks which console. I commented in the issue asking someone to collect info.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Finally got the AccountManager login (mostly) working, by following bits and pieces found on the Web. Notes and links:

Still needs work, doesn't work in the sync service.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

And after I spent so much time on this, turns out there is a super-easy way to do login: use weblogin:service=androiddeveloper&continue=https://play.google.com/apps/publish/v2/ as the token type to get a 'magic' (includes a short lived 'uber token') URL that automatically logs you in and returns all needed cookies. Cf. DeviceAccountLogin.java in the Android browser code.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

Just tried it, good work. One thing, if I press no to the authentication activity, the app will keep re-launching the authentication activity until you press back multiple times very quickly, this doesn't look like the expected behaviour from the code.

Now the only thing that really isn't working is the comment count.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

I see you've noticed the same thing I did :) Re: the number of comments, the second parameter seems to be the page size (50), and even for the web console the number of comments is only an approximation until you get to the end. If this the console is running on App Engine (most probably is), there is really no way to get the exact count. So I did a similar thing: one request to get approx number, one more to get the last page, which gives you the exact number. Probably no 100% foolproof, but gives correct results for my apps.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Syncing is probably broken ATM, will look into it. The current implementation does this in a separate process, which probably has something to do with it (and defeats the purpose of all caching).

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

I see you've noticed the same thing I did :)

Yep, should make it quicker and avoid parsing past all that stats data which is good.

Re: the number of comments, the second parameter seems to be the page size (50), and even for the web console the number of comments is only an approximation until you get to the end. If this the console is running on App Engine (most probably is), there is really no way to get the exact count. So I did a similar thing: one request to get approx number, one more to get the last page, which gives you the exact number. Probably no 100% foolproof, but gives correct results for my apps.

I don't think this quite works. Using this I get 139 (whereas v1 says 140, and if I request say 200 comments, or just the 200th comment (request 200, 0), I get 140. But then for Andlytics, which has 202 comments, it gets the correct result. Ideally we need someone with 1000+ comments to test this, but I think we might need to perform upto three requests in some cases. I've been experimenting with asking for just 1 comment, e.g. the 1000th comment, could then do the same of asking for the returned result plus 1000. The servers do return an error if you ask for the 9999'th comment etc, so we cannot just ask for the 999999th comment, but I assume thats only because its so much higher than my number of comments.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Yes, not ideal. You won't get the exact number unless you get the last page. And if the approximate number is off by too much, simply backing off one page might still give you the wrong result. It can probably be fine tuned if we have enough data (for up to 1000 comments the approx number is off by about 50%, etc.), or simply go forward until you get an error and then backtrack.

from andlytics.

willlunniss avatar willlunniss commented on June 4, 2024

@EricLarch Could you test the dev-console-v2 branch to see what it says for number of comments. Backup your stats first using the export option as the database revision will change so you will have to clean the app's data before reverting back.

from andlytics.

scarr avatar scarr commented on June 4, 2024

Does the email/password based authenticator still work?
Tried using it and the post to https://accounts.google.com/ServiceLoginAuth?service=androiddeveloper just returns a redirect.
Thanks.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

@scarr Should work, but there is no need to use anymore, it now uses AccountManager to get a login token. Are you trying it via the app or manually?

from andlytics.

scarr avatar scarr commented on June 4, 2024

Hi,
Am using it manually as a snippet to try and programmatically log in to
the Android Developer console, but I get a 302 redirect in response to the
Auth Post, without the required AD cookie.

Thanks for your response.

Rgds
Sean

On Fri, Nov 2, 2012 at 1:05 AM, Nikolay Elenkov [email protected]:

@scarr https://github.com/scarr Should work, but there is no need to
use anymore, it now uses AccountManager to get a login token. Are you
trying it via the app or manually?


Reply to this email directly or view it on GitHubhttps://github.com//issues/67#issuecomment-10001888.

from andlytics.

nelenkov avatar nelenkov commented on June 4, 2024

Redirects are OK, it should follow them automatically and eventually give you a 200 with the dev console. I just tried it and it works in the app, what have you modified?

from andlytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.