I try to listen to Beacons when the application is closed (killed) on Android (task manager is disabled).
I also use Appcelerator Titanium 5+ for beacons using the https://github.com/dwk5123/android-altbeacon-module module. The application works fine when it is in the background, but not when you close it. I tried the Altbeacon.setRunInService () method, creating an application service on Titanium, and it does not seem to work.
I also tried changing the module to implement this http://altbeacon.imtqy.com/android-beacon-library/background_launching.html , but I canβt access the Application Class because Titanium generates it during the build process. If I create an application class and put it in the manifest, it will overwrite my Titanium application application class and will not start it.
In addition, in the module class "AndroidAltbeaconModuleModule", I tried to implement the BootstrapNotifier interface and its methods: didDetermineStateForRegion , didEnterRegion and didExitRegion . Then the onAppCreate method tried to implement:
Region region = new Region("My Region", Identifier.parse( "00000000-0000-0000-0000-000000000001"), null, null); regionBootstrap = new RegionBootstrap(this, region);
but this on regionBootstrap constructor is not static and got an error about it.
Secondly, I tried to create a non-static method and call this code from a module. It successfully listens for BootstrapNotifier events, but not, if the application is killed, only in the background. Is this because regionBootstrap is not in the onCreate method of the Application class? I checked this question Using the AltBeacon library without the Application extension and Embedding the BootstrapNotifier in the Activity instead of the application class as Well So where davidgyoung (creator of Altbeacon lib) gave a good answer, but not possible (at least for me) to be implemented with Titanium.
The only way to spot a beacon with an app killed with this app functionality? I tried a little to implement JobService and BroadcastReceiver in the module, but I am not such a good Java / Android developer and it can take a lot of time. Anyone have an extra idea? Please share it =)
Thanks in advance!
android titanium appcelerator-titanium altbeacon
Carlos Henrique Lustosa
source share