Ionic agent
Prerequisites
Cordova 10, Capacitor 5
Android
- Android 8.0 or higher - min SDK 21
- Android Gradle Plugin - 4.2.0+
- Gradle version - 6.7.1+
IOS
- Mac OS 10.15.7 and above
- iOS 12 and above
- Download Install X-Code 12.2 and above
- Install cocoa pods in system
Adding SixthSense Ionic dependency (Common for iOS & Android)
Add the package dependency in the package.json file.
After adding the dependency, run the following commands to set the appropriate registry, authenticate, and download SixthSense Ionic dependency.
SixthSense Ionic dependency will download in the node modules folder.
- Open the main.ts file and do the following changes:
a. Add the following code in the main.ts file.
- Create a new global-error-handler.ts file inside the Project/src/app folder and add the following code in the file.
(OPTIONAL - need to implement if global error handler not there(specific to angular)):
- Save all changes and perform
ionic build
.
Android
- Install SixthSense Mobile Monitoring Android SDK and add the dependency to your build.gradle file in the dependencies block.
- Add the following lines to repositories block for downloading dependencies.
Configuring using AndroidManifest.xml
- Configure the Access Token in the application tag
You can find Access Token from the SixthSense dashboard. For accessing your access token, see Accessing your access token.
- Similarly configure reporting Base URL
- Initialize SSObservability in the OnCreate callback of your MainApplication.java:
This will capture crashes and ANRs and list them on dashboard. To report handled exceptions in native (Java) code use the SSLogger as given below.
To automatically capture http requests made using the Fetch API:
- Add the following to buildscript under dependencies block.
- Apply the plugin in module level build.gradle
The requirements for the above Http clients' auto instrumentation is as follows:
- Android Gradle Plugin - 7.1+
- Gradle version - 7.2+
IOS
To implement SixthSenseMobileSDK.
a. Open the xcworkspace file in X-Code.
b. Open the Podfile inside the Pods folder and add pod 'SixthSenseMobileSDK'.
c. Open the Project in terminal and run pod update command. It will download the SixthSenseMobileSDK file in the Sample app.
d. Go to AppDelegate class and import SixthSenseMobileSDK. Initialise SDK in didDinishLaunching function with the following code.
SixthSenseMobile.shared.initSixthSenseMobileSDK()
e. Open the Info.plist file and add the "AccessToken" key as a string and also add the value for the same.
f. Open the Info.plist file and add "EndPointName" key as a string and also add the value "https://http-collector-observability.sixthsense.rakuten.com/poc-mobile/"
Testing the build
You are now in an Xcode workspace for building, debugging, and testing the Mobile Monitoring capability.
- For force crash, import SixthSenseMobileSDK in any View Controller class and call fatalError().
- Run the application in simulator/device and try to make the application crash. After crashing, relaunch the application in simulator/device.
- Open the Mobile Monitoring dashboard and go to the Mobile Monitoring tab and check the crash logs and other matrices.