My server creates a link that redirects and passes parameters to google play store;
The sms I receive by my Server; https://goo.gl/{UNIQUE_ID}
when I click, I actually click on this this url below; http://www.mycompany.com/env=dev&token=123&id=456
The link above directs me to google play store to my app included parameters; https://play.google.com/store/apps/details?id=com.mycompany.app&referrer=123,456
Here is the question;(First time installation) When I install the app opened with the link above, I want to pass those "token", "id" parameters to my app in first time then I will skip login. These parameters creating by server because they are also unique to user.
I have setup the "com.android.vending.INSTALL_REFERRER" and I am able to receive parameters as expected but not consistent on every devices and could face with big delays.
<receiver
android:name=".GooglePlayReceiver"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
My GooglePlayReceiver Broadcastreceiver is;
public class GooglePlayReceiver extends BroadcastReceiver {
Context mContext;
String purchaseId = null;
public GooglePlayReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
try {
mContext = context;
Bundle extras = intent.getExtras();
String verificationCode = null;
String phoneNumber = null;
if (extras != null) {
String code = extras.getString("referrer");
String[] strArr = code != null ? code.split(",") : new String[0];
token = strArr[0];
id = strArr[1];
}
} catch (Exception ex) {
}
}}
This flow has big delays on some devices. For ex, Google Pixel 2 fetches the parameters immediately without delay, Samsung Galaxy S7 has 5-10 seconds delay.
How to solve this?