fix(android): resolve DailyNotification plugin registration issue
- Move plugin registration before super.onCreate() in MainActivity - Create dedicated dailynotification module for proper plugin structure - Add comprehensive logging for plugin registration debugging - Update Vue components with enhanced plugin detection and logging - Fix TypeScript errors in HomeView.vue for proper build The plugin was not being loaded because registration happened after BridgeActivity initialization. Moving registerPlugin() before super.onCreate() ensures the plugin is available when Capacitor loads plugins. Resolves simplified status dialog issue by ensuring native plugin is properly registered and accessible to JavaScript layer.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
namespace "com.timesafari.dailynotification"
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':capacitor-android')
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{
|
||||
"name": "DailyNotification",
|
||||
"classpath": "com.timesafari.dailynotification.DailyNotificationPlugin"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.timesafari.dailynotification;
|
||||
|
||||
import com.getcapacitor.JSObject;
|
||||
import com.getcapacitor.Plugin;
|
||||
import com.getcapacitor.PluginCall;
|
||||
import com.getcapacitor.PluginMethod;
|
||||
import com.getcapacitor.annotation.CapacitorPlugin;
|
||||
|
||||
@CapacitorPlugin(name = "DailyNotification")
|
||||
public class DailyNotificationPlugin extends Plugin {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
// Log that the plugin has loaded
|
||||
android.util.Log.d("DailyNotificationPlugin", "Plugin load() method called");
|
||||
System.out.println("DN|PLUGIN_LOAD_START");
|
||||
}
|
||||
|
||||
@PluginMethod
|
||||
public void echo(PluginCall call) {
|
||||
String value = call.getString("value");
|
||||
JSObject ret = new JSObject();
|
||||
ret.put("value", value);
|
||||
call.resolve(ret);
|
||||
}
|
||||
|
||||
@PluginMethod
|
||||
public void checkStatus(PluginCall call) {
|
||||
JSObject ret = new JSObject();
|
||||
ret.put("status", "OK from native plugin");
|
||||
call.resolve(ret);
|
||||
}
|
||||
|
||||
@PluginMethod
|
||||
public void scheduleNotification(PluginCall call) {
|
||||
String title = call.getString("title");
|
||||
String message = call.getString("message");
|
||||
JSObject ret = new JSObject();
|
||||
ret.put("scheduleResult", "Notification '" + title + "' scheduled with message '" + message + "'");
|
||||
call.resolve(ret);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user