How to add a android widget and access variable values?

I made an ionic application. But now I need a widget. So I import the ‘platform/android’ folder in android studio after doing ‘ionic cordova build android’ command.

I made a widget. But now I need to access some variable values from my TypeScript code of Ionic.

What I see is, there’s an assets folder inside which is ‘www’ which contains ‘main.js’.

Now this ‘main.js’ has some of my code but Ionic did some Magic on it :stuck_out_tongue:

How can I access these variable so that I can Populate my Widgets items? Also is this the right way?
How do I build APK using Ionic commands after doing changes in Android Studio? Will everything get overwritten?