mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Mobile: Trying RN notification
This commit is contained in:
parent
60d2b0c763
commit
8ccf2ec521
@ -137,6 +137,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compile project(':react-native-push-notification')
|
||||||
compile project(':react-native-fs')
|
compile project(':react-native-fs')
|
||||||
compile project(':react-native-image-picker')
|
compile project(':react-native-image-picker')
|
||||||
compile project(':react-native-vector-icons')
|
compile project(':react-native-vector-icons')
|
||||||
|
@ -10,6 +10,20 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
|
||||||
|
|
||||||
|
<!-- ==================================== -->
|
||||||
|
<!-- START react-native-push-notification -->
|
||||||
|
<!-- ==================================== -->
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<permission
|
||||||
|
android:name="${applicationId}.permission.C2D_MESSAGE"
|
||||||
|
android:protectionLevel="signature" />
|
||||||
|
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
|
<!-- ================================== -->
|
||||||
|
<!-- END react-native-push-notification -->
|
||||||
|
<!-- ================================== -->
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
android:targetSdkVersion="22" />
|
android:targetSdkVersion="22" />
|
||||||
@ -20,6 +34,38 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<!-- ==================================== -->
|
||||||
|
<!-- START react-native-push-notification -->
|
||||||
|
<!-- ==================================== -->
|
||||||
|
<receiver
|
||||||
|
android:name="com.google.android.gms.gcm.GcmReceiver"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="com.google.android.c2dm.permission.SEND" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||||
|
<category android:name="${applicationId}" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
|
||||||
|
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
|
||||||
|
<service
|
||||||
|
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
|
||||||
|
android:exported="false" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
<!-- ================================== -->
|
||||||
|
<!-- END react-native-push-notification -->
|
||||||
|
<!-- ================================== -->
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
@ -3,6 +3,7 @@ package net.cozic.joplin;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
import com.facebook.react.ReactApplication;
|
import com.facebook.react.ReactApplication;
|
||||||
|
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
|
||||||
import com.imagepicker.ImagePickerPackage;
|
import com.imagepicker.ImagePickerPackage;
|
||||||
import com.facebook.react.ReactNativeHost;
|
import com.facebook.react.ReactNativeHost;
|
||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
@ -31,6 +32,7 @@ public class MainApplication extends Application implements ReactApplication {
|
|||||||
return Arrays.<ReactPackage>asList(
|
return Arrays.<ReactPackage>asList(
|
||||||
new ImageResizerPackage(),
|
new ImageResizerPackage(),
|
||||||
new MainReactPackage(),
|
new MainReactPackage(),
|
||||||
|
new ReactNativePushNotificationPackage(),
|
||||||
new ImagePickerPackage(),
|
new ImagePickerPackage(),
|
||||||
new ReactNativeDocumentPicker(),
|
new ReactNativeDocumentPicker(),
|
||||||
new RNFetchBlobPackage(),
|
new RNFetchBlobPackage(),
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
rootProject.name = 'Joplin'
|
rootProject.name = 'Joplin'
|
||||||
|
include ':react-native-push-notification'
|
||||||
|
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
|
||||||
include ':react-native-fs'
|
include ':react-native-fs'
|
||||||
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
|
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
|
||||||
include ':react-native-image-picker'
|
include ':react-native-image-picker'
|
||||||
|
5
ReactNativeClient/package-lock.json
generated
5
ReactNativeClient/package-lock.json
generated
@ -4705,6 +4705,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-popup-menu/-/react-native-popup-menu-0.8.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-popup-menu/-/react-native-popup-menu-0.8.3.tgz",
|
||||||
"integrity": "sha1-HbsLT4iclBC2myKKidV7Vq6lzC4="
|
"integrity": "sha1-HbsLT4iclBC2myKKidV7Vq6lzC4="
|
||||||
},
|
},
|
||||||
|
"react-native-push-notification": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-native-push-notification/-/react-native-push-notification-3.0.1.tgz",
|
||||||
|
"integrity": "sha1-DiPbMC0Du0o/KNwHLcryqaEXjtg="
|
||||||
|
},
|
||||||
"react-native-side-menu": {
|
"react-native-side-menu": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-side-menu/-/react-native-side-menu-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-side-menu/-/react-native-side-menu-1.1.3.tgz",
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"react-native-material-dropdown": "^0.5.2",
|
"react-native-material-dropdown": "^0.5.2",
|
||||||
"react-native-popup-dialog": "^0.9.35",
|
"react-native-popup-dialog": "^0.9.35",
|
||||||
"react-native-popup-menu": "^0.8.3",
|
"react-native-popup-menu": "^0.8.3",
|
||||||
|
"react-native-push-notification": "^3.0.1",
|
||||||
"react-native-side-menu": "^1.1.3",
|
"react-native-side-menu": "^1.1.3",
|
||||||
"react-native-sqlite-storage": "3.3.*",
|
"react-native-sqlite-storage": "3.3.*",
|
||||||
"react-native-vector-icons": "^4.4.2",
|
"react-native-vector-icons": "^4.4.2",
|
||||||
|
@ -37,10 +37,11 @@ const { _, setLocale, closestSupportedLocale, defaultLocale } = require('lib/loc
|
|||||||
const RNFetchBlob = require('react-native-fetch-blob').default;
|
const RNFetchBlob = require('react-native-fetch-blob').default;
|
||||||
const { PoorManIntervals } = require('lib/poor-man-intervals.js');
|
const { PoorManIntervals } = require('lib/poor-man-intervals.js');
|
||||||
const { reducer, defaultState } = require('lib/reducer.js');
|
const { reducer, defaultState } = require('lib/reducer.js');
|
||||||
|
const PushNotification = require('react-native-push-notification');
|
||||||
|
|
||||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
||||||
const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js');
|
const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js');
|
||||||
const SyncTargetOneDriveDev = require('lib/SyncTargetOneDriveDev.js');
|
const SyncTargetOneDriveDev = require('lib/SyncTargetOneDriveDev.js');
|
||||||
|
|
||||||
SyncTargetRegistry.addClass(SyncTargetOneDrive);
|
SyncTargetRegistry.addClass(SyncTargetOneDrive);
|
||||||
SyncTargetRegistry.addClass(SyncTargetOneDriveDev);
|
SyncTargetRegistry.addClass(SyncTargetOneDriveDev);
|
||||||
|
|
||||||
@ -364,6 +365,15 @@ async function initialize(dispatch, backButtonHandler) {
|
|||||||
reg.scheduleSync();
|
reg.scheduleSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PushNotification.localNotificationSchedule({
|
||||||
|
message: "My Notification Message", // (required)
|
||||||
|
date: new Date(Date.now() + (10 * 1000)) // in 60 secs
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
reg.logger().info('Application initialized');
|
reg.logger().info('Application initialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user