diff --git a/app/src/main/java/github/nisrulz/projecteasydeviceinfo/MainActivity.java b/app/src/main/java/github/nisrulz/projecteasydeviceinfo/MainActivity.java index 1aa0dcc..e304f45 100644 --- a/app/src/main/java/github/nisrulz/projecteasydeviceinfo/MainActivity.java +++ b/app/src/main/java/github/nisrulz/projecteasydeviceinfo/MainActivity.java @@ -65,6 +65,8 @@ public class MainActivity extends AppCompatActivity { ArrayAdapter adapter = null; + private EasyAdsMod easyAdsMod = null; + @SuppressLint("MissingPermission") @TargetApi(VERSION_CODES.LOLLIPOP_MR1) @Override @@ -72,6 +74,8 @@ protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main); + easyAdsMod = new EasyAdsMod(getApplicationContext()); + //Data Array List of Info Object final ArrayList data = new ArrayList<>(); @@ -101,7 +105,7 @@ protected void onCreate(final Bundle savedInstanceState) { emailString.append('-'); } - final EasyAdsMod easyAdsMod = new EasyAdsMod(this); + easyAdsMod.getAndroidAdId(new AdIdentifierCallback() { @Override public void onSuccess(final String adIdentifier, final boolean adDonotTrack) { @@ -181,7 +185,7 @@ public void onSuccess(final String adIdentifier, final boolean adDonotTrack) { if (easySimMod.isMultiSim()) { final List activeMultiSimInfo = easySimMod.getActiveMultiSimInfo(); - if (activeMultiSimInfo != null) { + if (activeMultiSimInfo.size() > 0) { final StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < activeMultiSimInfo.size(); i++) { stringBuilder.append("\nSIM ") @@ -452,4 +456,10 @@ public void onBackPressed() { super.onBackPressed(); this.finish(); } + + @Override + protected void onDestroy() { + easyAdsMod.clear(); + super.onDestroy(); + } }