Java Code Examples for com.akdeniz.googleplaycrawler.GooglePlayAPI#setLocalization()

The following examples show how to use com.akdeniz.googleplaycrawler.GooglePlayAPI#setLocalization() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayManager.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Create a connection object for accessing Google Play, using an arbitrary
 * profile
 * 
 * @param profile
 *          the profile to use for connecting
 * @return a connection according to the submitted profile
 */
public static GooglePlayAPI createConnection(PlayProfile profile) {
	GooglePlayAPI ret = new GooglePlayAPI(profile.getUser(),
			profile.getPassword());
	ret.setUseragent(profile.getAgent());
	ret.setAndroidID(profile.getGsfId());
	ret.setToken(profile.getToken());
	Locale l = Locale.getDefault();
	String s = l.getLanguage();
	if (l.getCountry() != null) {
		s = s + "-" + l.getCountry();
	}
	ret.setLocalization(s);
	try {
		HttpClient proxy = createProxyClient(profile);
		if (proxy != null) {
			ret.setClient(proxy);
		}
	}
	catch (Exception e) {
		e.printStackTrace();
	}
	return ret;
}
 
Example 2
Source File: SearchWorker.java    From Raccoon with Apache License 2.0 6 votes vote down vote up
private Vector<BulkDetailsEntry> doQuerySearch() throws Exception {
	GooglePlayAPI service = App.createConnection(archive);
	service.setLocalization(localization);
	SearchResponse response = service.search(search, offset, limit);

	List<String> apps = new Vector<String>();
	if (response.getDocCount() > 0) {
		DocV2 all = response.getDoc(0);
		for (int i = 0; i < all.getChildCount(); i++) {
			apps.add(all.getChild(i).getBackendDocid());
			if (fetchIcons) {
				fetchIcon(all.getChild(i));
			}
		}
	}
	BulkDetailsResponse bdr = service.bulkDetails(apps);
	Vector<BulkDetailsEntry> ret = new Vector<BulkDetailsEntry>();
	for (int i = 0; i < bdr.getEntryCount(); i++) {
		ret.add(bdr.getEntry(i));
	}
	return ret;
}
 
Example 3
Source File: InitWorker.java    From Raccoon with Apache License 2.0 6 votes vote down vote up
@Override
protected String doInBackground() throws Exception {
	publish("");
	// Register the account with GPlay.
	GooglePlayAPI service = App.createConnection(archive);
	service.setLocalization(Locale.getDefault().getCountry());
	if ("".equals(archive.getAndroidId())) {
		service.checkin();
		service.login();
		service.uploadDeviceConfig();
	}
	else {
		service.login();
	}
	// Persist credentials through a separate object...
	Archive a = new Archive(archive.getRoot());
	a.setUserId(archive.getUserId());
	a.setPassword(archive.getPassword());
	a.setAndroidId(service.getAndroidID());
	a.saveCredentials();
	// ... and transport back the new aid, so we only modify the submitted
	// archive on the UI thread.
	return service.getAndroidID();
}
 
Example 4
Source File: DetailsWorker.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
@Override
protected DocV2 doInBackground() throws Exception {
	publish("");
	GooglePlayAPI service = App.createConnection(archive);
	service.setLocalization(Locale.getDefault().getCountry());
	return service.details(appId).getDocV2();
}