Get Mail ID from Google PlayStore when downloading apk

If someone downloads my android site from google playstore is there any way to grab / get my mail id before running my app even the first time.

Cause. Some users downloaded my app from the Google Play Store, but they didn't even open my app. so I need to capture them.

I can get the email id using the following code.

String emailList = "";
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
Account[] accounts = AccountManager.get(ctx).getAccounts();
for (Account account : accounts) {
    if (emailPattern.matcher(account.name).matches()) {
        emailList += account.name;
    }
}

      

but I need a broadcast receiver to be launched as soon as my app is installed from Google PlayStore. Is it possible? is there any other way like google analytics etc.?

+3


source to share


2 answers


Until the user manually launches your application, the application will stop and receive broadcast messages (usually BOOT_COMPLETED for most developers).



What you are trying to achieve is impossible.

+1


source


You cannot get the play store account id before launch, as the application has not been launched yet before launch. But once launched, you can get the PlayStore account connected to the device using the following code snippet

AccountManager.get(getActivity()).getAccountsByType("com.google")

      



Learn more about Broadcast Receiver package setup

Broadcast Action: A new application package has been installed on the device. The data contains the name of the package. Note that the newly installed package does not receive this broadcast.

      

+1


source







All Articles