I started to use Trusted Web Activiy
and everything is fine.
Now I want to install Push Notification
library and my push ntification service provider needs to add a block of code in MAIN ACTIVITY
.
From other hand, I need some check before user start visiting my website like:
So, I need manuplate a splash screen and Main Activity
, but I don't know where is main activity to do stuff as I'm newbie to this.
Would you please let me know how should I solve this issues?
Thanks in Advance
You can add a new activity, say MainActivity, which will start at application startup instead of TWA activity and do any additional processing in it's onCreate() method. In the end of onCreate() method you can activate your TWA activity with the intent like this:
startActivity(new Intent(this, com.google.androidbrowserhelper.trusted.LauncherActivity.class));
To make MainActivity the one which opens at application start you will have to remove intent filter from your TWA activity in AndroidManifest.xml and place it into your MainActivity:
<activity android:name=".java.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Some more details in this post: https://stackoverflow.com/a/58069713/8818281