Muestra de version de la app funcionando correctamente a la version 1.2

parent 8a746203
......@@ -20,8 +20,7 @@ import java.io.InputStream;
* @version 1.0
*/
public class DeviceHelper {
public static float version= Float.valueOf(BuildConfig.VERSION_NAME).floatValue();
//Float.valueOf(PCBcontext.getContext().getResources().getString(R.string.app_version)).floatValue();
public static float version= Float.valueOf(BuildConfig.VERSION_NAME);
public static String getDBName(Context context) {
return context.getResources().getString(R.string.db_name);
......
......@@ -155,7 +155,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
public void result(JSONObject result) {
try {
final float version = Float.valueOf(result.getString("version"));
if (PCBcontext.getActivityContext() != null && version > DeviceHelper.getAppVersion() && newVersionContext!=PCBcontext.getActivityContext()) {
newVersionContext=PCBcontext.getActivityContext(); // prevent from showing several times the alert
newVersionAlert(version,PCBcontext.getActivityContext(), version);
......
......@@ -4,14 +4,13 @@ package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;
import com.yottacode.pictogram.tabletlibrary.BuildConfig;
import com.yottacode.pictogram.dao.DeviceHelper;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext;
import java.util.Timer;
import java.util.TimerTask;
......@@ -35,14 +34,7 @@ public class SplashScreenActivity extends Activity {
setContentView(R.layout.activity_splash_screen);
TextView version = (TextView) findViewById(R.id.labelVersion);
PackageInfo pInfo = null;
try {
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
String versionName = pInfo.versionName;
version.setText(getResources().getString(R.string.version_label)+" "+BuildConfig.VERSION_NAME);
version.setText(getResources().getString(R.string.version_label)+" "+DeviceHelper.getAppVersion());
TimerTask task = new TimerTask() {
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment