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

@@ -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