7070import java .util .List ;
7171import java .util .Objects ;
7272
73+ import io .sentry .Sentry ;
74+
7375public class MainActivity extends ImisActivity {
7476 private static final int REQUEST_PERMISSIONS_CODE = 1 ;
7577 private static final int REQUEST_ALL_FILES_ACCESS_CODE = 2 ;
@@ -295,6 +297,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
295297 }
296298 } catch (Exception e ) {
297299 Log .e (LOG_TAG , "Error while copying master data." , e );
300+ Sentry .captureException (e );
298301 }
299302 }
300303 }
@@ -314,6 +317,7 @@ public void PickMasterDataFileDialog() {
314317 try {
315318 startActivityForResult (intent , REQUEST_PICK_MD_FILE );
316319 } catch (ActivityNotFoundException e ) {
320+ Sentry .captureException (e );
317321 Toast .makeText (getApplicationContext (), getResources ().getString (R .string .NoFileExporerInstalled ), Toast .LENGTH_SHORT ).show ();
318322 }
319323 }).setNegativeButton (getResources ().getString (R .string .No ),
@@ -331,6 +335,7 @@ public AlertDialog confirmRefreshMap() {
331335 doLoggedIn (() -> DownLoadDiagnosesServicesItems (global .getOfficerCode ()));
332336 } catch (Exception e ) {
333337 e .printStackTrace ();
338+ Sentry .captureException (e );
334339 }
335340 },
336341 (dialog , i ) -> dialog .cancel ());
@@ -420,6 +425,7 @@ public AlertDialog DownloadMasterDialog() {
420425 }
421426 } catch (Exception e ) {
422427 e .printStackTrace ();
428+ Sentry .captureException (e );
423429 DownloadMasterDialog ();
424430 }
425431 } else {
@@ -454,6 +460,7 @@ private void checkForUpdates() {
454460 mNotificationManager .notify (SIMPLE_NOTIFICATION_ID , builder .build ());
455461 } catch (Exception e ) {
456462 e .printStackTrace ();
463+ Sentry .captureException (e );
457464 }
458465
459466 vibrator = (Vibrator ) getSystemService (VIBRATOR_SERVICE );
@@ -490,6 +497,7 @@ public void run() {
490497 });
491498 } catch (Exception e ) {
492499 e .printStackTrace ();
500+ Sentry .captureException (e );
493501 runOnUiThread (() -> {
494502 progressDialog .dismiss ();
495503 if (!global .isNetworkAvailable ()){
@@ -539,6 +547,7 @@ public void getClaimAdmins() {
539547
540548 } catch (Exception e ) {
541549 e .printStackTrace ();
550+ Sentry .captureException (e );
542551 runOnUiThread (() -> {
543552 progressDialog .dismiss ();
544553 if (!global .isNetworkAvailable ()){
@@ -628,6 +637,7 @@ public void downloadServices(@NonNull final String claimAdminCode) {
628637 }
629638 } catch ( Exception e ) {
630639 e .printStackTrace ();
640+ Sentry .captureException (e );
631641 if (!global .isNetworkAvailable ()){
632642 Toast .makeText (MainActivity .this , getResources ().getString (R .string .CheckConnection ), Toast .LENGTH_LONG ).show ();
633643 } else {
@@ -675,6 +685,7 @@ public void downloadItems(@NonNull final String claimAdminCode) {
675685 }
676686 } catch (Exception e ) {
677687 e .printStackTrace ();
688+ Sentry .captureException (e );
678689 if (!global .isNetworkAvailable ()){
679690 Toast .makeText (MainActivity .this , getResources ().getString (R .string .CheckConnection ), Toast .LENGTH_LONG ).show ();
680691 } else {
@@ -716,6 +727,7 @@ public void validateClaimAdminCode(final String claimAdminCode) {
716727 doLoggedIn (() -> DownLoadDiagnosesServicesItems (claimAdminCode ));
717728 } catch (Exception e ) {
718729 e .printStackTrace ();
730+ Sentry .captureException (e );
719731 }
720732 }
721733 c .close ();
@@ -778,6 +790,7 @@ public void run() {
778790 });
779791 } catch (Exception e ) {
780792 e .printStackTrace ();
793+ Sentry .captureException (e );
781794 runOnUiThread (() -> {
782795 progressDialog .dismiss ();
783796 if (!global .isNetworkAvailable ()){
@@ -837,6 +850,7 @@ public void run() {
837850 });
838851 } catch (Exception e ) {
839852 e .printStackTrace ();
853+ Sentry .captureException (e );
840854 runOnUiThread (() -> {
841855 progressDialog .dismiss ();
842856 if (!global .isNetworkAvailable ()){
0 commit comments