Hotfix user_agent

This commit is contained in:
masensio 2015-04-09 11:16:13 +02:00
parent 2444e4254c
commit 7696c08565
2 changed files with 7 additions and 4 deletions

View file

@ -9,7 +9,7 @@
<string name ="data_folder">owncloud</string>
<string name ="log_name">Owncloud_</string>
<string name ="default_display_name_for_root_folder">ownCloud</string>
<string name ="user_agent">Mozilla/5.0 (Android) ownCloud</string>
<string name ="user_agent">Mozilla/5.0 (Android) ownCloud-android/%1$s</string>
<!-- URLs and flags related -->
<string name="server_url"></string>

View file

@ -29,6 +29,9 @@ import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy;
import com.owncloud.android.lib.common.utils.Log_OC;
import org.apache.commons.codec.StringEncoder;
/**
* Main Application of the project
*
@ -131,14 +134,14 @@ public class MainApp extends Application {
try {
pInfo = getAppContext().getPackageManager().getPackageInfo(packageName, 0);
if (pInfo != null) {
version = "/" + pInfo.versionName;
version = pInfo.versionName;
}
} catch (PackageManager.NameNotFoundException e) {
Log_OC.e(TAG, "Trying to get packageName", e.getCause());
}
// Mozilla/5.0 (Android) ownCloud /1.7.0
String userAgent = appString + version;
// Mozilla/5.0 (Android) ownCloud-android/1.7.0
String userAgent = String.format(appString, version);
return userAgent;
}