mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 16:25:17 +00:00
Ready to pre-configure independent notifications service
This commit is contained in:
@ -1,6 +1,23 @@
|
||||
package org.communiquons.comunic;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.communiquons.comunic.independentnotifications.NotificationsChannel;
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity;
|
||||
import io.flutter.embedding.engine.FlutterEngine;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
|
||||
private static final String INDEPENDENT_NOTIFICATIONS_CHANNEL = "org.communiquons.comunic/independent-push-notifications-service";
|
||||
|
||||
@Override
|
||||
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine);
|
||||
|
||||
new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), INDEPENDENT_NOTIFICATIONS_CHANNEL)
|
||||
.setMethodCallHandler(new NotificationsChannel());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package org.communiquons.comunic.independentnotifications;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
|
||||
public class NotificationsChannel implements MethodChannel.MethodCallHandler {
|
||||
@Override
|
||||
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
||||
try {
|
||||
|
||||
if (call.method.equals("preConfigure"))
|
||||
preConfigure(result);
|
||||
|
||||
else
|
||||
result.notImplemented();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.error("Failed to execute native code!", e.getMessage(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-configure notifications service
|
||||
*/
|
||||
private static void preConfigure(@NonNull MethodChannel.Result result) throws Exception {
|
||||
System.out.println("Ready to pre-configure !");
|
||||
}
|
||||
}
|
@ -26,4 +26,4 @@ subprojects {
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user