5959import java .util .ArrayList ;
6060import java .util .List ;
6161
62+ import io .sentry .Sentry ;
63+ import io .sentry .android .core .SentryAndroid ;
64+
6265
6366public class MainActivity extends ImisActivity {
6467 private static final int REQUEST_PERMISSIONS_CODE = 1 ;
@@ -284,6 +287,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
284287 (d , i ) -> finish ());
285288 }
286289 } catch (Exception e ) {
290+ Sentry .captureException (e );
287291 Log .e (LOG_TAG , "Error while copying master data." , e );
288292 }
289293 }
@@ -304,6 +308,7 @@ public void PickMasterDataFileDialog() {
304308 try {
305309 startActivityForResult (intent , REQUEST_PICK_MD_FILE );
306310 } catch (ActivityNotFoundException e ) {
311+ Sentry .captureException (e );
307312 Toast .makeText (getApplicationContext (), getResources ().getString (R .string .NoFileExporerInstalled ), Toast .LENGTH_SHORT ).show ();
308313 }
309314 }).setNegativeButton (getResources ().getString (R .string .No ),
@@ -320,6 +325,7 @@ public AlertDialog confirmRefreshMap() {
320325 try {
321326 doLoggedIn (() -> DownLoadDiagnosesServicesItems (global .getOfficerCode ()));
322327 } catch (Exception e ) {
328+ Sentry .captureException (e );
323329 e .printStackTrace ();
324330 }
325331 },
@@ -410,6 +416,7 @@ public AlertDialog DownloadMasterDialog() {
410416 }
411417 } catch (Exception e ) {
412418 e .printStackTrace ();
419+ Sentry .captureException (e );
413420 DownloadMasterDialog ();
414421 }
415422 } else {
@@ -443,6 +450,7 @@ private void checkForUpdates() {
443450 try {
444451 mNotificationManager .notify (SIMPLE_NOTIFICATION_ID , builder .build ());
445452 } catch (Exception e ) {
453+ Sentry .captureException (e );
446454 e .printStackTrace ();
447455 }
448456
@@ -480,6 +488,7 @@ public void run() {
480488 });
481489 } catch (Exception e ) {
482490 e .printStackTrace ();
491+ Sentry .captureException (e );
483492 runOnUiThread (() -> {
484493 progressDialog .dismiss ();
485494 ErrorDialogBox (e .getMessage ());
@@ -520,6 +529,7 @@ public void getClaimAdmins() {
520529 });
521530 } catch (Exception e ) {
522531 e .printStackTrace ();
532+ Sentry .captureException (e );
523533 runOnUiThread (() -> progressDialog .dismiss ());
524534 }
525535 });
@@ -555,6 +565,7 @@ public void validateClaimAdminCode(final String claimAdminCode) {
555565 progressDialog .dismiss ();
556566 doLoggedIn (() -> CheckHealthFacility (claimAdminCode , HealthFacilityName ));
557567 } catch (Exception e ) {
568+ Sentry .captureException (e );
558569 e .printStackTrace ();
559570 }
560571 }
@@ -671,6 +682,7 @@ public void run() {
671682 });
672683 } catch (Exception e ) {
673684 e .printStackTrace ();
685+ Sentry .captureException (e );
674686 runOnUiThread (() -> {
675687 progressDialog .dismiss ();
676688 Toast .makeText (MainActivity .this , e .getMessage () + "-" + getResources ().getString (R .string .SomethingWentWrongServer ), Toast .LENGTH_LONG ).show ();
@@ -715,6 +727,7 @@ public void run() {
715727 });
716728 } catch (Exception e ) {
717729 e .printStackTrace ();
730+ Sentry .captureException (e );
718731 runOnUiThread (() -> {
719732 progressDialog .dismiss ();
720733 Toast .makeText (MainActivity .this , e .getMessage () + "-" + getResources ().getString (R .string .AccessDenied ), Toast .LENGTH_LONG ).show ();
0 commit comments