---
title: "Discussion on \"Building custom Android modules for React Native\" | Hashnode"
description: "Discussion on \"Building custom Android modules for React Native\". React Native applications have two sides (React's JavaScript side and the Android side). Assume these two sides are two sides of a river. Obviously, you need a bridge to cross this river. The React Native team built bridges for major things like Came..."
url: "https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building custom Android modules for React Native](https://hashnode.com/post/building-custom-android-modules-for-react-native?utm_source=hashnode&utm_medium=feed)

React Native applications have two sides (React's JavaScript side and the Android side). Assume these two sides are two sides of a river. Obviously, you need a bridge to cross this river. The React Native team built bridges for major things like Came...

Jul 7, 2016 · hashnode.com  
Updated Dec 24, 2016  
Read the article

-   [#react-native](https://hashnode.com/tag/react-native)
-   [#android](https://hashnode.com/tag/android)

## Written by

[Sriraman](https://hashnode.com/@sriraman)

@sriraman · Bangalore, India

  
[View profile](https://hashnode.com/@sriraman)

Software Engineer @ LifeOn24

I&#39;m a passionate Web Developer. I create awesome stuff for web. Now, Not only Web (using React Native :P).

## Responses 3

Markdown supported · ⌘↵ to post

[Matteo Mazzarolo](https://hashnode.com/@mmazzarolo)

[Jul 8, 2016](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/577f48f2a4b6f17ba3a6e177)

Hey! Nice introduction tutorial! Do you have any suggestion on the implementation/bridging of an Android service in React-Native?  
I'm asking because I'm considering all the available options for making [react-native-beacons-android](https://github.com/mmazzarolo/react-native-beacons-android) works even when the app is killed.  
Thanks ;)

[Sriraman](https://hashnode.com/@sriraman)

[Jul 8, 2016](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/577f48f2a4b6f17ba3a6e177#reply-577f4f4016a33191db042fc5)

Background service would be killed by Android on low memory. If you run the service in the foreground, then the service will not be killed. Running the service in the foreground will generate a persistent notification in the notification drawer.

Check [developer.android.com/guide/components/services.h…](https://developer.android.com/guide/components/services.html#Foreground) for more information

[Matteo Mazzarolo](https://hashnode.com/@mmazzarolo)

[Jul 8, 2016](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/577f48f2a4b6f17ba3a6e177#reply-577f5156a4b6f17ba3a6e183)

Yep, I know, but what about making the service comunicate with React-Native?  
Do you have any experience/example on this?  
And thanks for the fast answer man!

[Sriraman](https://hashnode.com/@sriraman)

[Jul 8, 2016](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/577f48f2a4b6f17ba3a6e177#reply-577f5b6ea4b6f17ba3a6e18f)

React Native won't be alive in background. Obviously, the Event listener which we created in the React Native layer will also be destroyed. Communication might not be possible. Some people said that it is possible to start the Javascript core from the background. But, I never tried it. I'll let you know if I find some workaround.

[lee](https://hashnode.com/@lee_dabiker)

[Nov 1, 2016](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/5817e543ae2865e5ada27bce)

Thanks for this Sriraman, If I want to simply tweak an existing module e.g. react-native-maps to include map style capability, I need to import com.google.android.gms.maps.model.MapStyleOptions; in .java file that extends an Android MapView. However when running the app, it appears the MapStyleOptions is not in scope. Can you give me a clue, what are the steps to make this accessible in the Java? would i need to rebuild somehow from the original master? I don't see a reference to the other imports in this file elsewhere in the project for an example of how it was done.

[Sriraman](https://hashnode.com/@sriraman)

[Nov 2, 2016](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/5817e543ae2865e5ada27bce#reply-5819705b2ca37f164781f603)

There are two ways to do it. You can create a new react native module and add the react-native-maps as the dependency.

[Francisco Murillo](https://hashnode.com/@frazko)

[Sep 8, 2017](https://hashnode.com/posts/building-custom-android-modules-for-react-native/577e5018a4b6f17ba3a6e0ff/comment/59b2b138fb7c41281647b309)

Hi, I came here looking for an answer, I need to measure a custom component, but in react native you don't get the method .measure unless it's a native UI component as far as I understand from this:

The methods described here are available on most of the default components provided by React Native. Note, however, that they are not available on composite components that aren't directly backed by a native view. This will generally include most components that you define in your own app.

measure(callback)

... my question is: Making a Bridged (as in this tutorial) component will make it get .measure method? I'd like to know before learning to do this so at least i won't have false expectations...

thank you!
