You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To build your own Android Widget, use this project to bootstrap the widget and hack upon or replicate the strategy to make it work.
22
29
23
30
## How it works
24
31
It consists in several Android and React Native concepts. Please read with eskepticism, other formulas may be simpler.
25
32
* Your React Native app, bundles all the JS, even the one
26
33
corresponding to your widget and services. It is the main [Activity](https://developer.android.com/reference/android/app/Activity.html) of the Android realm.
27
34
* A [WidgetProvider](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html) is meant to render the view onto your Android desktop and also to listen for the events (button presses) that will be sent to your app. It is then, a Broadcast receiver that can process in Java different intents, before it reaches the JS side.
28
-
*An[Headless JS task](https://facebook.github.io/react-native/docs/headless-js-android.html) is the React Native approach to an Android Service. This part will process the intents (events) coming from your WidgetProvider.
35
+
*A[Headless JS task](https://facebook.github.io/react-native/docs/headless-js-android.html) is the React Native approach to an Android Service. This part will process the intents (events) coming from your WidgetProvider.
29
36
* A custom [Native Module](https://facebook.github.io/react-native/docs/native-modules-android.html) is used to bridge the JS realm with the AppWidgetProvider.
30
37
31
38
If you take a look at the AndroidManifest.xml you can see how the Android relevant parts are declared to the system:
@@ -73,3 +80,10 @@ We haven't done this, but we belive that from this point has to be much easier,
73
80
having the strategy laid down, we'd need to create [Native UI Components](https://facebook.github.io/react-native/docs/native-components-android.html)
74
81
calling methods from the `RemoteView` class and context instead of the `View` class.
75
82
It is not trivial to us, though.
83
+
84
+
85
+
<ahref="https://getyeti.co"target="_blank">
86
+
<imgalt="works with yeti"src="screenshots/works-with-yeti.png"width="100" />
87
+
</a>
88
+
89
+
> This proof of concept is applied at [Yeti Smart Home](https://getyeti.co) and is used in production. Some of the art is also produced at Netbeast. Follow us in Github or [Twitter](https://twitter.com/netbeast_co).
0 commit comments