added notifications for mobile

This commit is contained in:
2024-10-31 08:56:21 +02:00
parent 6ed45501f7
commit 77ef45345d
11 changed files with 428 additions and 338 deletions

View File

@@ -11,7 +11,9 @@ apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-browser')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-local-notifications')
implementation project(':evva-capacitor-secure-storage-plugin')
implementation project(':transistorsoft-capacitor-background-fetch')
implementation "androidx.webkit:webkit:1.4.0"
}

View File

@@ -8,7 +8,8 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true">
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name=".MainActivity"
@@ -40,4 +41,5 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
</manifest>

View File

@@ -0,0 +1,31 @@
package com.example.app;
import android.content.Context;
import android.util.Log;
import com.transistorsoft.tsbackgroundfetch.BackgroundFetch;
import com.transistorsoft.tsbackgroundfetch.BGTask;
public class BackgroundFetchHeadlessTask{
public void onFetch(Context context, BGTask task) {
// Get a reference to the BackgroundFetch Android API.
BackgroundFetch backgroundFetch = BackgroundFetch.getInstance(context);
// Get the taskId.
String taskId = task.getTaskId();
// Log a message to adb logcat.
Log.d("MyHeadlessTask", "BackgroundFetchHeadlessTask onFetch -- CUSTOM IMPLEMENTATION: " + taskId);
boolean isTimeout = task.getTimedOut();
// Is this a timeout?
if (isTimeout) {
backgroundFetch.finish(taskId);
return;
}
// Do your work here...
//
//
// Signal finish just like the Javascript API.
backgroundFetch.finish(taskId);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -21,6 +21,10 @@ allprojects {
repositories {
google()
mavenCentral()
maven {
// capacitor-background-fetch
url("${project(':transistorsoft-capacitor-background-fetch').projectDir}/libs")
}
}
}

View File

@@ -8,5 +8,11 @@ project(':capacitor-browser').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android')
include ':capacitor-local-notifications'
project(':capacitor-local-notifications').projectDir = new File('../node_modules/@capacitor/local-notifications/android')
include ':evva-capacitor-secure-storage-plugin'
project(':evva-capacitor-secure-storage-plugin').projectDir = new File('../node_modules/@evva/capacitor-secure-storage-plugin/android')
include ':transistorsoft-capacitor-background-fetch'
project(':transistorsoft-capacitor-background-fetch').projectDir = new File('../node_modules/@transistorsoft/capacitor-background-fetch/android')