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

parent 8a746203
...@@ -20,8 +20,7 @@ import java.io.InputStream; ...@@ -20,8 +20,7 @@ import java.io.InputStream;
* @version 1.0 * @version 1.0
*/ */
public class DeviceHelper { public class DeviceHelper {
public static float version= Float.valueOf(BuildConfig.VERSION_NAME).floatValue(); public static float version= Float.valueOf(BuildConfig.VERSION_NAME);
//Float.valueOf(PCBcontext.getContext().getResources().getString(R.string.app_version)).floatValue();
public static String getDBName(Context context) { public static String getDBName(Context context) {
return context.getResources().getString(R.string.db_name); return context.getResources().getString(R.string.db_name);
......
...@@ -155,7 +155,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -155,7 +155,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
public void result(JSONObject result) { public void result(JSONObject result) {
try { try {
final float version = Float.valueOf(result.getString("version")); final float version = Float.valueOf(result.getString("version"));
if (PCBcontext.getActivityContext() != null && version > DeviceHelper.getAppVersion() && newVersionContext!=PCBcontext.getActivityContext()) { if (PCBcontext.getActivityContext() != null && version > DeviceHelper.getAppVersion() && newVersionContext!=PCBcontext.getActivityContext()) {
newVersionContext=PCBcontext.getActivityContext(); // prevent from showing several times the alert newVersionContext=PCBcontext.getActivityContext(); // prevent from showing several times the alert
newVersionAlert(version,PCBcontext.getActivityContext(), version); newVersionAlert(version,PCBcontext.getActivityContext(), version);
......
...@@ -4,14 +4,13 @@ package com.yottacode.pictogram.tabletlibrary.gui.login; ...@@ -4,14 +4,13 @@ package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.Window; import android.view.Window;
import android.widget.TextView; 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.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
...@@ -35,14 +34,7 @@ public class SplashScreenActivity extends Activity { ...@@ -35,14 +34,7 @@ public class SplashScreenActivity extends Activity {
setContentView(R.layout.activity_splash_screen); setContentView(R.layout.activity_splash_screen);
TextView version = (TextView) findViewById(R.id.labelVersion); TextView version = (TextView) findViewById(R.id.labelVersion);
PackageInfo pInfo = null; version.setText(getResources().getString(R.string.version_label)+" "+DeviceHelper.getAppVersion());
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);
TimerTask task = new TimerTask() { TimerTask task = new TimerTask() {
@Override @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