Search code examples
androidaltbeaconbeaconeddystone

Android beacon library run after install new version


I have kontakt.io Eddystone beacon and try to write app for scanning beacon. I use Android Beacon Library and background scanning.

All about detecting beacon after kill is write here: https://altbeacon.github.io/android-beacon-library/resume-after-terminate.html

Is there any way to run application immediatelly after install new version of application from store?

App automatically run after connect device to charger, but is there any way to run app using this library immediatelly after install?


Solution

  • Interesting question, but unfortunately the answer is no. The app has to be run at least once before it can scan for beacons for a number of reasons:

    1. Android doesn't allow executing any custom code at app install time, as would be needed to start scanning for beacons.

    2. On Android 6+ the user needs to be interactively prompted for permission to access the user's Location, otherwise background scanning for beacons is not allowed.

    It is possible to have an app register to receive events (like power connect/disconnect) to kick off scanning, but these may not fire if the app has not been run once. If it does (at least on some models) it may be possible to register for other custom events that happen more frequently to kick it off the first time. This would approximate what you want to do on pre-Android 6 devices.

    Full disclosure: I am the lead developer on the Android Beacon Library open source project.