npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-gimbal

v1.0.0

Published

React Native module for Gimbal SDK

Downloads

1

Readme

react-native-gimbal

Installation

Clone github.com/PaeDae/react-native-gimbal-sdk. Run npm pack from the repo directory to produce a .tz file. Unzip the .tz and rename the contained directory as desired. Add this directory as a library to your React-Native project by running yarn add [directory path] from your project directory. If you are using create-react-app, you must eject the app to expose native code.
If you are using Expo, you must run exp detach to expose native code.

Android:

In MainApplication.java, add:

  1. import com.gimbal.android.Gimbal;
  2. In MainApplication class private static final String GIMBAL_APP_API_KEY = "YOUR GIMBAL API KEY HERE";
  3. In onCreate() method Gimbal.setApiKey(this, GIMBAL_APP_API_KEY);

iOS:

In AppDelegate.m, add:

  1. #import <Gimbal/Gimbal.h>
  2. In didFinishLaunchingWithOptions method: [Gimbal setAPIKey:@"YOUR GIMBAL API KEY HERE" options:nil];

Extra steps needed on React Native v0.60+:
cd ios && pod install && cd ..

To use communicates, extra implementation steps are required in native Objective-C, most likely in AppDelegate.m. First, obtain a reference to the CommunicationManager and assign a delegate to UNUserNotificationCenter:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  _communicationManagerModule = [bridge moduleForName:@"CommunicationManager"];


  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
  center.delegate = self;
  ...
}

Then implement UNUserNotificationCenterDelegate.didReceiveNotificationResponse:

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void (^)(void))completionHandler
{
  if (_communicationManagerModule == nil) {
    return;
  }
  
  SEL handleResponseSelector = NSSelectorFromString(@"handleNotificationResponse:completionHandler:");
  
  if ([_communicationManagerModule respondsToSelector:handleResponseSelector]) {
    IMP handleResponseImplementation = [_communicationManagerModule methodForSelector:handleResponseSelector];
    CGRect (*handleResponseFunction)(id, SEL, UNNotificationResponse*, void (^)(void)) = (void *)handleResponseImplementation;

    handleResponseFunction(_communicationManagerModule, handleResponseSelector, response, completionHandler);
  }
}

To run the app:

  • Android: yarn react-native run-android or npx react-native run-android
  • iOS: yarn react-native run-ios or npx react-native run-ios

Troubleshoot

If you encounter this error: Unsupported class file major version 57.
It could be that JDK version 13 does not work well with React Native 0.60+. Use JDK 11.


API

Gimbal

// start the Gimbal module:
Gimbal.start();

// check status:
Gimbal.isStarted();

// get the application ID:
Gimbal.getApplicationInstanceIdentifier();

// stop the Gimbal SDK:
Gimbal.stop();

PrivacyManager

PrivacyManager.getGdprConsentRequirement();

PrivacyManager.setUserConsent(PrivacyManager.GDPR_CONSENT_TYPE_PLACES, stateValue);

PrivacyManager.getUserConsent(PrivacyManager.GDPR_CONSENT_TYPE_PLACES);

PlaceManager

PlaceManager.startMonitoring();

PlaceManager.stopMonitoring();

PlaceManager.isMonitoring();

// event types:
'VisitStart'
'VisitStartWithDelay'
'VisitEnd'
'BeaconSighting'
'LocationDetected'

GimbalDebugger

GimbalDebugger.enableBeaconSightingsLogging();
GimbalDebugger.disableBeaconSightingsLogging();
GimbalDebugger.isBeaconSightingsLoggingEnabled();

GimbalDebugger.enableDebugLogging();
GimbalDebugger.disableDebugLogging();
GimbalDebugger.isDebugLoggingEnabled();

GimbalDebugger.enablePlaceLogging();
GimbalDebugger.disablePlaceLogging();
GimbalDebugger.isPlaceLoggingEnabled();

CommunicationManager

CommunicationManager.startReceivingCommunications();
CommunicationManager.stopReceivingCommunications();
CommunicationManager.isReceivingCommunications();
//Only Android:
CommunicationManager.setNotificationChannelId("");
CommunicationManager.getNotificationChannelId();
Communicationmanager.handleNotificationResponse();

// event types:
'PrepareCommunicationForDisplay'
'PresentNotificationForCommunications'
'NotificationClicked'