Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isReady() never ever return true!!! - please help #25

Open
olli3 opened this issue Jun 4, 2019 · 5 comments
Open

isReady() never ever return true!!! - please help #25

olli3 opened this issue Jun 4, 2019 · 5 comments

Comments

@olli3
Copy link

olli3 commented Jun 4, 2019

GA 7.4.1 Tiapp.xml updated as per docs

Ti.API.info('isReady - '+Alloy.Globals.TiBeacons.isReady());

never ever returns true 1

please help

Ti.Android.requestPermissions([ 'android.permission.ACCESS_FINE_LOCATION' ], (e) => {
if (e.success) {

                // wait for beacons library to be ready
                let handle = setInterval(() => {

                        Ti.API.info('isReady - '+Alloy.Globals.TiBeacons.isReady());

                    if(!Alloy.Globals.TiBeacons.isReady()) return;
                    clearInterval(handle);
                    handle = null;

                    // listen for beacon proximity events
                    Alloy.Globals.TiBeacons.addEventListener('beaconProximity', (e) => {
                        const identifier = e.source.identifier,
                              uuid = e.source.uuid,
                              power = e.source.power;

                        Ti.API.info(`identifier: ${identifier}, uuid: ${uuid}, power: ${power}`);
                    });

                    // monitor for our specific beacons
                    Alloy.Globals.TiBeacons.startMonitoringForRegion({
                        identifier: 'iBeacon',
                        uuid: '1ED323F5-E1CB-6B4C-2418-B8D760237BDE'
                    });
                    Alloy.Globals.TiBeacons.startMonitoringForRegion({
                        identifier: 'iBeacon',
                        uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
                    });

                }, 1000);
            } else {
                Ti.API.error(e.error);
            }
@roelandp
Copy link

roelandp commented Jun 9, 2019

@olli3

I was also stumbling upon this, tried a couple of things but then gave up as the module seemed to not give any data out, not even errors or something when I tried to debug in android-monitor.

Not to disrespect this module or @jamesfalkner at all, but just to help, here is what I did to get Beacons working on latest Ti 8.0.1 --> (just finished this 'whitsundays debugging session'):

Hence replaced the 'liferay-android-beacons' with an 'altbeacon version' from https://github.com/Sensimity/android-altbeacon-module/ (original by: com.drtech.altbeacon)

git cloned that one and basically vanilla rebuilt the module with my current 8.0.1.GA. appc run -p android --build-only Ti Cli then asked:

Detected Titanium 8.0.1 that requires API-level 4, but the module currently only supports 6.0.0.GA and API-level 3.
Do you want to migrate your module now? (yes|no) [yes]: yes

and all worked flawlessly after that on device right now.

Worked out of the box following the samples given, and from the Sensity github I even found a commit, which has a "servicebound" event, so don't need to use the "setInterval" to monitor whether iBeaconService has become available.

I was not aware, but now I am, that AltBeacon supports multiple "beaconLayouts" and therefore also the Apple's iBeacon format, (as you can see in the Altbeacon Layout) example: AltbeaconModule.addBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"); (which is the layout format for apple ibeacon 👍 )

ok, hope it works for you too.

@olli3
Copy link
Author

olli3 commented Jun 10, 2019

sounds great...

Worked out of the box following the samples given, and from the Sensity github I even found a commit, which has a "servicebound" event, so don't need to use the "setInterval" to monitor whether iBeaconService has become available.

  1. do i need to add this too ?
  2. does this module require location -> always or would while in app work ?

i cloned the module, then rebuild as you said 👍

then took the module from the dist/com.drtech.altbeacon-android-3.0.0.zip
unzipped this and dragged to usual place.

included in tiapp.xml

then ran the app, crashes on load...

-- Start application log -----------------------------------------------------
[INFO] TiApplication: (main) [0,0] checkpoint, app created.
[WARN] W/ : Unable to open '/system/framework/WfdCommon.jar': No such file or directory
[WARN] art: Failed to open zip archive '/system/framework/WfdCommon.jar': I/O Error
[WARN] W/ : Unable to open '/system/framework/com.qti.location.sdk.jar': No such file or directory
[WARN] art: Failed to open zip archive '/system/framework/com.qti.location.sdk.jar': I/O Error
[INFO] MultiDex: VM with version 2.1.0 has multidex support
[INFO] MultiDex: Installing application
[INFO] MultiDex: VM has multidex support, MultiDex support library is disabled.
[INFO] art: Starting a blocking GC HeapTrim

any chance you could share your built module ?

@roelandp
Copy link

i have the module here -->
roelandp/catchall@0d33448

what android are you running on? Did you appc ti clean to clean your dir prior to building & deploying? Maybe you are missing some NDK shizzle idk.

Let me know if you have success with my module! I'm running (and building) on 8.0.1.GA fyi.

@olli3
Copy link
Author

olli3 commented Jun 10, 2019

do you have an email address i can ping you on ?

@jamesfalkner
Copy link
Owner

@roelandp Thanks for the info on altbeacon! I haven't had time to maintain this project for several years, and am surprised it still even compiles :) (I designed it for a previous job in which I am no longer in, and an app which no longer exists!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants