I'm developing an Android app where I have used Firebase Password Authentication to sign in users.
After users provide their email and password, I'm sending a verification e-mail using FirebaseAuth SDK.
/** SEND A VERIFICATION MAIL TO THE USER **/
ActionCodeSettings.Builder settingBuilder = ActionCodeSettings.newBuilder();
String url = getString(R.string.link_mail_verification);
settingBuilder.setUrl(url).setHandleCodeInApp(true);
ActionCodeSettings settings = settingBuilder.build();
user.sendEmailVerification(settings).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
Log.e("MAIL_VERIFICATION", "onComplete: mail verification sent" );
}else{
// not sent
}
}
});
While verifying their email, I want users to be redirected in the app directly if it is installed, that's where I used Dynamic link
First, I started by creating a Dynamic Link in the firebase console

Secondly I modified the firebase e-mail template to use my dynamic link as the action url.

and in the e-mail sent to the user , some query parameters (e.g: oobCode, apiKey) are appended to the dynamic link.

When the user clicks the above link, it correctly redirects to the app and open the activity that is registered to receive dynamic links.
My real problem is , how can I, from an Android application get all the query parameters present in the link sent to the user.
The methods that I tried so far, and didn't work : Method 1 : trying to get the query from Intent
FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent()).addOnSuccessListener(new OnSuccessListener<PendingDynamicLinkData>() {
@Override
public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
Uri deepLink = null;
if(pendingDynamicLinkData != null){
deepLink = pendingDynamicLinkData.getLink();
}
// trying to get from the intent
if(deepLink != null){
Uri intentData = getIntent().getData();
if(intentData != null){
String code = getIntent().getStringExtra("oobCode"); // always returns null
}
}
}
});
Method 2: trying to get the query parameter from PendingDynamicLinkData
FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent()).addOnSuccessListener(new OnSuccessListener<PendingDynamicLinkData>() {
@Override
public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
Uri deepLink = null;
if(pendingDynamicLinkData != null){
deepLink = pendingDynamicLinkData.getLink();
}
// trying to get from the deep link URI
if(deepLink != null){
String code = deepLink.getQueryParameter("oobCode"); // returns null too
}
}
});
And the following is my manifest.xml
<activity
android:name=".activities.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="@string/app_link_domain"
android:scheme="https"
/>
</intent-filter>
</activity>