|
|
@@ -1,18 +1,24 @@
|
|
|
package com.hola;
|
|
|
|
|
|
+import static androidx.core.content.ContextCompat.startActivity;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
import android.app.AlarmManager;
|
|
|
import android.app.NotificationChannel;
|
|
|
import android.app.NotificationManager;
|
|
|
import android.app.PendingIntent;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
+import android.net.Uri;
|
|
|
import android.os.Build;
|
|
|
import android.os.SystemClock;
|
|
|
+import android.provider.Settings;
|
|
|
import android.util.Log;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
+import com.facebook.react.bridge.Callback;
|
|
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
|
import com.facebook.react.bridge.ReactMethod;
|
|
|
@@ -35,6 +41,31 @@ public class HolaModule extends ReactContextBaseJavaModule {
|
|
|
return MODULE_NAME;
|
|
|
}
|
|
|
|
|
|
+ @ReactMethod
|
|
|
+ public void openNotificationSettings() {
|
|
|
+ Activity currentActivity = getCurrentActivity();
|
|
|
+ Context context = getReactApplicationContext();
|
|
|
+// Intent intent = new Intent();
|
|
|
+// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
|
+// intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
|
|
+// intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
|
|
|
+// } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
|
|
+// intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
|
|
+// intent.putExtra("app_package", context.getPackageName());
|
|
|
+// intent.putExtra("app_uid", context.getApplicationInfo().uid);
|
|
|
+// } else {
|
|
|
+// intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
+// intent.addCategory(Intent.CATEGORY_DEFAULT);
|
|
|
+// intent.setData(Uri.parse("package:" + context.getPackageName()));
|
|
|
+// }
|
|
|
+// currentActivity.startActivity(intent);
|
|
|
+
|
|
|
+ Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
+ Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
|
|
+ intent.setData(uri);
|
|
|
+ currentActivity.startActivity(intent);
|
|
|
+ }
|
|
|
+
|
|
|
@ReactMethod
|
|
|
public void addLocalPush(String title,String content,String time){
|
|
|
if (getCurrentActivity()==null){
|