-
-
Save developerPratik/392796a9ba1e9f617af29c7dc556efb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.reactnative.example.reactnativemodules; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
import java.util.Map; | |
import javax.annotation.nullable; | |
import com.crashlytics.android.Crashlytics; | |
import com.facebook.react.bridge.ReactMethod; | |
public class CrashlyticsModule extends ReactContextBaseJavaModule{ | |
public CrashlyticsModule(ReactApplicationContext applicationContext){ | |
super(applicationContext); | |
} | |
@Override | |
public string getName(){ | |
return "CrashlyticsModule"; | |
} | |
@Nullable | |
@Override | |
public Map<String, Object> getConstants(){ | |
return super.getConstants(); | |
} | |
@ReactMethod | |
public void SetUserProfile(string profile){ | |
Crashlytics.setStrint("profile", profile); | |
} | |
@ReactMethod | |
public void Log(String tag, String message){ | |
Crashlytics.log(Log.DEBUG, tag, message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.reactnative.example; | |
import com.facebook.react.ReactPackage; | |
import com.facebook.react.bridge.JavaScriptModule; | |
import com.facebook.react.bridge.NativeModule; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.uimanager.ViewManager; | |
import com.reactnative.example.reactnativemodules.CrashlyticsModule; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class ReactCrashlyticsPackage implements ReactPackage { | |
@Override | |
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { | |
List<NativeModule> modules = new ArrayList<>(); | |
modules.add(new CrashlyticsModule(reactContext)); | |
return modules; | |
} | |
public List<Class<? extends JavaScriptModule>> createJSModules() { | |
return Collections.emptyList(); | |
} | |
@Override | |
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | |
return Collections.emptyList(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment