项目作者: gaetanozappi

项目描述 :
Sample widget android for react-native.
高级语言: Java
项目地址: git://github.com/gaetanozappi/react-native-widget-listview.git
创建时间: 2018-06-23T11:09:17Z
项目社区:https://github.com/gaetanozappi/react-native-widget-listview

开源协议:Apache License 2.0

下载


React Native: Widget

platforms
github home

github issues
github closed issues
Issue Stats
github license

PNG

📖 Getting started

$ npm install react-native-background-timer --save

$ react-native link react-native-background-timer

Usage

Copy the following file:
widgetTask.js

In the main path of the project.

Import the file you just copied into index.js and index.android.js.

Write in the files mentioned above, the following code:

  1. AppRegistry.registerHeadlessTask('WidgetTask', () => WidgetTask);

Add to the manifest:

  1. + <uses-permission android:name="android.permission.INTERNET" ></uses-permission>
  2. + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></uses-permission>
  3. + <activity
  4. + android:name=".CustomReactActivity"
  5. + android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
  6. + android:label="@string/app_name"
  7. + android:windowSoftInputMode="adjustResize">
  8. + <intent-filter>
  9. + <category android:name="android.intent.category.DEFAULT" ></category>
  10. + </intent-filter>
  11. + </activity>
  12. + <receiver android:name="WidgetProvider">
  13. + <intent-filter>
  14. + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" ></action>
  15. + </intent-filter>
  16. + <meta-data android:name="android.appwidget.provider" android:resource="@xml/widgetprovider" />
  17. + </receiver>
  18. + <service android:name=".BackgroundTask" android:enabled="true" android:label="BackgroundAdd" ></service>
  19. + <service android:name=".WidgetService" android:permission="android.permission.BIND_REMOTEVIEWS" ></service>

Copy the files that are in the following locations:

  1. android\app\src\main\java\com\androidwidgetpoc\
  2. android\app\src\main\res\xml\
  3. android\app\src\main\res\layout\
  4. android\app\src\main\res\drawable\

License

This library is provided under the Apache License.