How to get user details upon app installation and before opening the app?

问题: As I'm trying to get the user details who just installed my app (user has not opened my app yet, just downloaded). This question arises as Google Play Console does not prov...

问题:

As I'm trying to get the user details who just installed my app (user has not opened my app yet, just downloaded). This question arises as Google Play Console does not provide stats. according to region wise (only the country/language/version/carrier etc wise). I'm trying to get user's State/Zip code to know which region the download has come from.

I have tried a solution which only works when the user opens the app and closes without any activity, in this scenario I'm starting a background service on my splash screen to get his/her current address and get zip code/ state.

This is my current solution flow:

User Opens App --> [1] Splash Screen --> User Closes my app

[1] --> [2] Background service to get his/her location and zip code --> [3] sending to server.

I'm looking for an answer where I can get the user's zip code/state or region for my internal app download stats(region wise).


回答1:

I think what you want to achieve is not possible unless you do the Broadcast receiver hack. From google play console developer you can check the download per country

enter image description here

But I guess you can not go that deep to know the zip code, also I don't think if it's legal.

It's hard to know everything without opening the app, so if you want to know this information you have to deal with this information in the Splash Activity so you can do whatever you want with that information.

To get the zip code you can use Geocoder API and use getFromLocaitonName method, so you get a List<Address> and you can getPostalCode() that will return :

Returns the postal code of the address, for example "94110", or null if it is unknown.

Small example would be (checking nullabilities example with nullabilities :

Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> mList = geocoder.getFromLocation(lat, lon, 1);
String zipcode = mList.get(0).getPostalCode();

Or you can take a look on this Get zip code from latitude longitude

  • 发表于 2019-04-01 20:59
  • 阅读 ( 185 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除