Search Unity

App works if installed directly, but not, if downloaded from Play Store

Discussion in 'Android' started by HectorSilva, Feb 24, 2020.

  1. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    I made an app, I tested it on my Android devices, all good. Then I published it in the Play Store (and App Store, but in App Store it works without problems), but when downloaded from the Play Store, it does not work properly. In particular, it reports an error when trying to connect to the Internet. Any idea what is happening? Thanks in advance.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Does app indicate that it needs internet permission when installing it from store?
     
  3. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    Thanks for answering.

    Could you please confirm if what I have to do is change "Internet access" from "Auto" to "Require" (as shown in the picture)? (I found this on the web, but I don't know if it's the same as you indicate.).

     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    If your app requires internet to work, then yes, this is the setting and it should be set to required.
    What I meant was, when you install app from Google Play, you should see a list of permissions the app requires. If internet permission is not among them, then it's an indication of setting above being incorrect.
     
  5. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    Thanks for answering.

    I followed the instructions on this page (https://stackoverflow.com/questions/37493936/android-internet-permission-in-unity). Basically recommend manually modifying AndroidManifest.xml to include the lines:

    <uses-permission android: name = "android.permission.INTERNET" />
    <uses-permission android: name = "android.permission.ACCESS_NETWORK_STATE" />


    However, after doing so (annexed AndroidManifest.xml renamed for upload), the problem persists.

    If I already included these lines in AndroidManifest.xml without getting the app to access the network, Is there anything else i should do?

    Thank you in advance.
     

    Attached Files:

  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    The manifest looks ok. Does your app ask for those permissions to be granted (on start up, or before trying to connect to the internet)?
     
  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Did you try getting an apk from Google Play console or even Unity, and drag & dropping it in Android Studio's APK Analyzer, and check the final manifest there. Maybe the final merged manifest doesn't contain those entries
     
  8. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    No, the app never asks for permission.
     
  9. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    I have not tried, I will try, thanks.
     
  10. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    I compared both manifests through Android Studio. While the Unity-generated APK does include the line:

    <uses-permission
    android: name = "android.permission.ACCESS_NETWORK_STATE" />

    The APK downloaded from the Play Store does not include it (as if Google had deleted it). Makes sense?

    Could it be the reason why my app does not access the Internet? (considering that the permission line for INTERNET does exist).

    Any advice about how to fix this?

    Thanks in advance.
     
  11. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    What about android.permission.INTERNET, is it available in both cases?
     
  12. HectorSilva

    HectorSilva

    Joined:
    Jun 20, 2015
    Posts:
    20
    So is. android.permission.INTERNET is available in both cases.