Native Android/IOS apps with Anvil

Anvil can build a great variety of apps. But how about an app that requires interaction with native android and iOS apis? The answer is, yes!

For this demo, I built an anvil app that can access and create new contacts on your phone. Under the hood is a React Native app that displays the Anvil App using a webview component. The react native app gets the data from the device and sends it to the anvil app. The contacts are then displayed in a repeating panel.

Communication with the react app can also be simplified and made more “anvil-like” with some lines of code

react_app.call("addContact", name, phone_no)

Source Code for the Anvil part Anvil | Login

Source Code for React Native parts

How to Test the App

For Android devices, you can directly test it out by downloading the APK from

(Your device may warn you that the app is unsafe since it is not verified)

Otherwise, you can run it locally on your device by following the instructions from the Github Repo

Of course, you can use frameworks other than React Native too. Just look out for a webview library in them.

When to use this method

Since it requires knowledge about developing native apps as well as continuous communication back and forth, this method would only make sense if -

  • You have already built an Anvil app and require some advanced functionalities without rebuilding everything

  • Most of your logic is in Anvil and you only want a few extra functionalities

It is also possible to determine whether your anvil app is running on the web or as a native app. You can use it to manage specific functionalities.

In any case, let me know your feedback or if you face any issues. Also, working for this app has not been tested on IOS since I don’t have access to it. But it should work most likely.

Screenshot of the App -

9 Likes