react-native-siam-piwat-indoormap
v1.3.2
Published
## Getting started
Downloads
28
Readme
react-native-siam-piwat-indoormap
Getting started
$ npm install [email protected] --save
OR
yarn add [email protected]
Mostly automatic installation
$ react-native link [email protected]
Note
For [email protected]
For iOS 11 or later
iOS
- Verify Podfile
pod 'SPWIndoormap', :path => '../node_modules/react-native-siam-piwat-indoormap/ios/RNIndoormap.podspec'
- Run
Pod install
- Add this code to
Appdelegate.m
Workaround
- dyld: Symbol not found or dyld: launch, loading dependent libraries
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
#import <RNIndoorMap/RNIndoorMap.h>
@implementation AppDelegate
- (instancetype)init
{
self = [super init];
if (self) {
[SPWIndoorMapManager initialSDKWithSlug:SPWApplicationIconSiam shops:@[]
language:SPWLanguageEnglish
appDelegate:[AppDelegate self]
isDebug:false simulateNavigation:false];
}
return self;
}
@end
Android
- Verify
compileSdkVersion = 29
- Add
mavenCentral()
tobuild.gradle
(in case of mising) - Add dependencies to
app/build.gradle
dependencies {
..
implementation 'io.github.smartsoftasia:indoormapsdk:0.9.12'
..
}
- Add this code to
MainApplication
file.
import com.siampiwat.indoormapsdk.IndoorMapSDK
override fun onCreate() {
super.onCreate()
IndoorMapSDK.init(this)
}
- Add this code to
MainActivity
// >>> import these <<<
import com.siampiwat.indoormapsdk.IndoorMapSDK
import com.siampiwat.indoormapsdk.data.appenum.SPWApplicationSlug
import com.siampiwat.indoormapsdk.data.appenum.SPWLanguage
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// >>> Add this method <<<
IndoorMapSDK.initialize(SPWApplicationSlug.ICON_SIAM, "", SPWLanguage.TH, true)
}
- Add activity to
AndroidMainifest.xml
<activity android:name="com.siampiwat.indoormap.IndoorMapView"/>
Usage
import {
presentIndoorMap,
getAllStores,
getVenues,
setOrigin,
setDestination,
setStores,
setFloorNumber,
resetOriginAndDestination
} from "react-native-siam-piwat-indoormap";
// set stores
setStores(<<shops (JSONArray)>>);
//get veunes
getVenues(() => {
// get stores
},
(err) => {},
);
// set floor number (Number: floor number 0 is G floor , -1 is B1)
setFloorNumber(<<floor number>>);
// set origin store
setOrigin(<<shop id>>);
// set destination store
setDestination(<<shop id>>);
// get all stores
getAllStores((result) => {
var stores = result;
});
// reset origin and destination
resetOriginAndDestination();
// present indoor map screen
presentIndoorMap();
Note
- You must set all stores before calling the getVenues method.
- You must get venues before presenting the indoor map screen.
- You should call the getVenues method only one time after setting all stores.
- Getting venues might return errors from the map provider, you need to get venues again in case of receiving an error.