简体   繁体   中英

Android Apps behave differently despite identical code

I downloaded an example of an Android project from this website: https://draeger-it.blog/android-app-programmierung-bluetooth-low-energy-connection-ble/?cn-reloaded=1

...and adjusted the code as mentioned in the comments. I was very happy to see it working on my Samsung Tab S7. Afterward, I created my own Android Project and just copied the code from the following three documents:

  • AndroidManifest.xml
  • MainActivity.java
  • activity_main.xml

Unfortunately, it is not working when using a new Project structure. One obvious difference is that every time I open the "original" / working project, the user is asked to grant permission for the device location. Using my own project, it seems like the user is only asked when running the App for the first time. Any ideas what else needs to be changed in the project, to get that working?

Thank you!

You have one more file that you should check, and that is the build.gradle file. You might not be using the same android API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM