Detecting for SIM Card change using sharedpreferences
===

I have managed to save my SIM card serial into the <package name>.preferences.xml inside a string called serial but now i want to compare my current serial.

When i boot up my phone using the android.intent.boot_completed broadcast receiver. The value inside  String value = sp.getString("serial", ""); i am unable to get the current value of the serial string to compare properly.


    		 TelephonyManager tMgr=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
      		 String currentSerial = tMgr.getSimSerialNumber();
      		 
      	     Toast.makeText(context, "Current Serial Number: " + currentSerial, Toast.LENGTH_LONG).show();
    
     SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
     String value = sp.getString("serial", "");
     
     if (value == currentSerial)
     {
    	 Toast.makeText(context, "SIM Change detected!", Toast.LENGTH_SHORT).show();
     }
     else {
    	 Toast.makeText(context, "No SIM Change detected!", Toast.LENGTH_SHORT).show();
     }