Skip to content

Commit cacd3b2

Browse files
author
jsdario
committed
Tries with bg timer
1 parent 7130ae9 commit cacd3b2

File tree

8 files changed

+3559
-3
lines changed

8 files changed

+3559
-3
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ It is a bit complicated, and we developed it with 0 knowledge from Android or Ja
1313
git clone https://github.com/jsdario/react-native-android-widget-poc
1414
cd react-native-android-widget-poc
1515
npm install # or yarn install
16+
react-native link react-native-background-timer # to avoid the main thread
1617
react-native run-android
1718
```
1819

1920
To build your own android widget start from this project as a widget and hack upon or replicate the strategy to make it work.
2021

2122
### How it works
22-
:construction: Needs to be filled
23+
:construction: This chapter is in construction
2324

2425
### Can I create widgets using React Native instead of Java?
2526
We haven't done this, but we belive that from this point has to be much easier,

android/app/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ android {
137137
}
138138

139139
dependencies {
140+
compile project(':react-native-background-timer')
140141
compile fileTree(dir: "libs", include: ["*.jar"])
141142
compile "com.android.support:appcompat-v7:23.0.1"
142143
compile "com.facebook.react:react-native:+" // From node_modules

android/app/src/main/java/com/androidwidgetpoc/MainApplication.java

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import com.ocetnik.timer.BackgroundTimerPackage;
67
import com.facebook.react.ReactNativeHost;
78
import com.facebook.react.ReactPackage;
89
import com.facebook.react.shell.MainReactPackage;
@@ -23,6 +24,7 @@ public boolean getUseDeveloperSupport() {
2324
protected List<ReactPackage> getPackages() {
2425
return Arrays.<ReactPackage>asList(
2526
new MainReactPackage(),
27+
new BackgroundTimerPackage(),
2628
new BackgroundTaskBridgePackage()
2729
);
2830
}

android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
rootProject.name = 'androidWidgetPoc'
2+
include ':react-native-background-timer'
3+
project(':react-native-background-timer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-timer/android')
24

35
include ':app'

0 commit comments

Comments
 (0)