joaquinlom / react-native-wikitude-sdk

Wikitude SDK to React Native
http://spinarplus.com
12 stars 14 forks source link

Example project #1

Closed tuvshinbatgeru closed 4 years ago

tuvshinbatgeru commented 4 years ago

Hello there.

Thanks for the contribution Could you upload an example project with the latest react native version?

I stuck with almost 3 days :(.

joaquinlom commented 4 years ago

Sorry for the delay. https://github.com/joaquinlom/react-native-wikitude-sdk-example

You can use this as a simple example.

tringapps-neel commented 4 years ago

Hey @joaquinlom , thanks for sharing the repo. After I run the project on Android it throws an error com.app.MainActivity cannot be cast to com.reactnativenavigation.NavigationActivity at start. After reloading it works perfectly fine. Can you guide me to solve the error?

spinarplus commented 4 years ago

Hey, if I remind correctly this issue it's related to the React Navigation Library.

tringapps-neel commented 4 years ago

Thanks @spinarplus, there was config needed for navigation. I am using Geo based how can I pass latitude and longitude from RN To wikitude ?

joaquinlom commented 4 years ago

You can use the React native Geolocation librari to getthe current location. You can pass it as javascript into your experience or use the injectLocation method in the wikitude component On Wed 23 Sep 2020 at 0:55 tringapps-neel notifications@github.com wrote:

Thanks @spinarplus https://github.com/spinarplus, there was config needed for navigation.

I am using Geo based how can I pass latitude and longitude from RN To wikitude ?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/joaquinlom/react-native-wikitude-sdk/issues/1#issuecomment-697172307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATOJEDLR7NBAIOT6V6S4SLSHGLX3ANCNFSM4M6VUBSQ .

-- I.S Joaquin Alan Valdez Lom tel: +52 (614) 181-22-17

tringapps-neel commented 4 years ago

Hi @joaquinlom thanks for responding. Like you mentioned calling injectLocation method, did the same but still the wikitude shows Trying to find out where you are

Console inside injectJavascript - Latitude 91.1691751 Longitude - 122.9586976 Checking Camera Permission - true Checking Platform - android

Also the ref is not empty

What else am I missing ?

joaquinlom commented 4 years ago

Hi @tringapps-neel. What example are you trying to test?.

tringapps-neel commented 4 years ago

@joaquinlom Inside Geo => Selecting POI

tringapps-neel commented 4 years ago

@joaquinlom digging deeper I found inside WikitudeViewManager.java => receiveCommand => case INJECT_LOCATION root.setLocation(args.getDouble(0),args.getDouble(1)); after this line no code is getting triggered. Can you suggest the solution or any pre-requisite required to run Geo POI ?

joaquinlom commented 4 years ago

Hey. Are you running the latest react-native-wikitude-sdk library?

Also,a workaround is to pass the location into the wiktiude as javascript and modify the Experiences to do the search.

I will update the example because it was using an old version and might be your issue.

tringapps-neel commented 4 years ago

Hey @joaquinlom, you are right! I am using the older version. Thanks for updating the repo :)

tringapps-neel commented 4 years ago

@joaquinlom In index.js of react-native-wikitude-sdk the merge conflicts are also been pushed.

tringapps-neel commented 4 years ago

@joaquinlom Can you update the example project? For Geo services it shows "Trying to fetch where you are" event after injection, also been using latest sdk. Can you check the repo for geo services usability ? Thanks

joaquinlom commented 4 years ago

@joaquinlom Can you update the example project? For Geo services it shows "Trying to fetch where you are" event after injection, also been using latest sdk. Can you check the repo for geo services usability ?

Thanks

Of course, I'm using the library on a prod app but with different approach. In the next days I will update the example. Stay tune.

tringapps-neel commented 4 years ago

@joaquinlom I am getting this issue on iOS when injecting location [native] Exception thrown while executing UI block: -[WikitudeView injectLocationWithAltitude:longitude:]: unrecognized selector sent to instance 0x11ae0cea0

when I comment this code -

WikitudeView *component = (WikitudeView *)view;
[component injectLocationWithAltitude:latitude longitude:longitude];

it does not crash..

Also have noticed onFinishLoading does not get called in ios, but in android I can see the trigger.

Can you suggest the solution or cause of error or am I missing any navigation config for iOS ?

tringapps-neel commented 4 years ago

Hi @joaquinlom any suggestion on above issue ? will be helpful

joaquinlom commented 4 years ago

Onfinishloading should be called on IOS (Im using rn).

About Geo, I will try to replicate the issue and see whats happening.

I suggest to send the location from RN to Wikitude using Javascript.(callJavascript)

joaquinlom commented 4 years ago

Hi @joaquinlom any suggestion on the above issue? will be helpful

I updated the Library with a fix for injectLocation. now you should be enabled to inject location on ios.

tringapps-neel commented 4 years ago

Hi @joaquinlom any suggestion on the above issue? will be helpful

I updated the Library with a fix for injectLocation. now you should be enabled to inject location on ios.

Thanks for an update. But still onFinishLoading is not been called. Also none of the examples are working, only wikitude camera is opening Am I missing anything to link ?

Following logs are printed when camera screen opens -

2020-10-13 01:43:45.913 [info][tid:com.facebook.react.JavaScript] 'URL WIKITUDE: ', '/assets/ARchitectExamples/08_PointOfInterest_4_SelectingPois/index'
2020-10-13 01:43:45.920 [info][tid:com.facebook.react.JavaScript] 'componentDidUpdateFunction', null
2020-10-13 01:43:45.924 [info][tid:com.facebook.react.JavaScript] 'Is focus', null
2020-10-13 01:43:45.953 [info][tid:com.facebook.react.JavaScript] 'URL WIKITUDE: ', '/assets/ARchitectExamples/08_PointOfInterest_4_SelectingPois/index'
2020-10-13 01:43:45.956 [info][tid:com.facebook.react.JavaScript] didmount Wikitude SDK index.js
2020-10-13 01:43:45.958441+0530 wikitudeExample[3472:1517412] Trying to call resume:
2020-10-13 01:43:45.962508+0530 wikitudeExample[3472:1516850] Metal API Validation Enabled
2020-10-13 01:59:09.892006+0530 wikitudeExample[3486:1521248] WF: _WebFilterIsActive returning: NO
2020-10-13 01:59:09.955890+0530 wikitudeExample[3486:1521248] InitWithFrame:
2020-10-13 01:59:09.957100+0530 wikitudeExample[3486:1521248] setLicenseKey in property Native:
2020-10-13 01:59:09.960155+0530 wikitudeExample[3486:1521248] setUrl in property Native: /assets/ARchitectExamples/08_PointOfInterest_4_SelectingPois/index
2020-10-13 01:59:09.960225+0530 wikitudeExample[3486:1521248] Es Local url: /assets/ARchitectExamples/08_PointOfInterest_4_SelectingPois/index
2020-10-13 01:59:09.960253+0530 wikitudeExample[3486:1521248] Start WikitudeSDK: runnning 0
2020-10-13 01:59:10.222562+0530 wikitudeExample[3486:1521248] SDK finish Started
2020-10-13 01:59:10.224416+0530 wikitudeExample[3486:1521248] View: Resume: <WikitudeView: 0x129faf490; frame = (0 0; 0 0); layer = <CALayer: 0x281ac9e00>>
2020-10-13 01:59:10.224574+0530 wikitudeExample[3486:1521248] resume UIView
2020-10-13 01:59:10.224634+0530 wikitudeExample[3486:1521248] Start WikitudeSDK: runnning 1
2020-10-13 01:59:10.224683+0530 wikitudeExample[3486:1521248] is Already running Wiki Resume loading again the url
2020-10-13 01:59:10.248050+0530 wikitudeExample[3486:1521248] layoutSubviews:

Can you update the example with geo support?

joaquinlom commented 4 years ago

Does only this example does not work?. Maybe its the assets is not being found.

tringapps-neel commented 4 years ago

@joaquinlom now geo is working on iOS by executing WikitudeSdkRendering at start inside setUrl method. Initially it runs perfectly but when we come back and forth inside AR Screen again it hangs and most of the time it crashes It also injects Location each time. In addition - If I wait for approx two minutes and then come back again on AR Screen it works fine. What can be the reason behind this behaviour ?

joaquinlom commented 4 years ago

@joaquinlom now geo is working on iOS by executing WikitudeSdkRendering at start inside setUrl method. Initially it runs perfectly but when we come back and forth inside AR Screen again it hangs and most of the time it crashes It also injects Location each time. In addition - If I wait for approx two minutes and then come back again on AR Screen it works fine. What can be the reason behind this behaviour ?

Yes, As you know React Native create the component tree and then updates his state, because of that there can be situation when the WikitudeSDK Tries to allocate again when is already initialize causing a crash. Are you running the latest version of the library?. Are you using React-Navigation?

tringapps-neel commented 4 years ago

@joaquinlom yes I am using react-navigation and using latest version of library. But in the example project which you shared also has the same behaviour on iOS which is without react-navigation.

I see this error in logs in sample project- Error: [com.wikitude.plugin][00:01:53.522.858] > Cannot add plugin because another plugin with the same id already exists. (code 10003)

If I comment line: 166 inside WikitudeView.m - Everything works fine. Can you confirm will it cause any break of code for production use.