eliminate the value of a variable in a service in android
<p>my program is an activity to identify a user when that user is identified by pressing a button sends the string to another class (alarmChecker) that extends to a service. This service does is check every 30 seconds if the value of a database has changed, and if you notice changes launches.</p>

<p>Sending the String in the main class (MainActivity) I do it like this:</p>

<pre><code>  / / Class MainActivity

  Intent intent = new Intent (MainActivity.this, alarmChecker.class);

  Bundle data = new Bundle ();
  data.putString ("user", user);
  intent.putExtras (data);
  pendingIntent = PendingIntent.getService (MainActivity.this, 0, intent, 0);
</code></pre>

<p>Then the class "alarmChecker" receives the parameter as follows:</p>

<pre><code> / / class alarmChecker

     @Override
public int onStartCommand(Intent intent, int flags, int startId){
    super.onStartCommand(intent, flags, startId);
// Toast.makeText(this, "MyAlarmService.onStart()", Toast.LENGTH_LONG).show();

 Bundle data = intent.getExtras();

 user = data.getString("user");

 Toast.makeText(getApplicationContext(), "user: "+user, Toast.LENGTH_LONG).show();
}
</code></pre>

<p>and I want to do is if the user presses the Return button or exit the application and return to the main screen (MainActivity) and identifies with another different user, alarmChecker class take the new values​​, but the problem is that the grabs. Always have the values ​​you enter the first time.</p>

<p>How to solve it?</p>

<p>Thanks for answering and greeting.</p>
