cordova-plugin-mserviceinterface-2.0 1.0.77 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "This plugin establishes the connection to the native interface and performs the requested task.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
- xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.77">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.78">
4
4
  <name>mserviceinterface-2.0</name>
5
5
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
6
6
  <author>selfservit@gmail.com</author>
@@ -14,7 +14,6 @@ import androidx.core.app.NotificationManagerCompat;
14
14
 
15
15
  import com.google.android.gms.location.Geofence;
16
16
  import com.google.android.gms.location.GeofencingEvent;
17
- import com.selfservit.pegdev.MainActivity;
18
17
 
19
18
  import org.json.JSONObject;
20
19
 
@@ -83,9 +82,14 @@ public class GeofenceBroadcastReceiver extends BroadcastReceiver {
83
82
  }
84
83
 
85
84
  private void sendNotification(Context context, String title, String message) {
85
+ try {
86
86
  String notification_icon, notification_color, app_name;
87
87
  int imageResource,notification_color_id;
88
- Intent intent = new Intent(context, MainActivity.class);
88
+ String packageName = context.getPackageName();
89
+ String mainActivityClassName = packageName + ".MainActivity";
90
+ Class<?> mainActivityName = null;
91
+ mainActivityName = Class.forName(mainActivityClassName);
92
+ Intent intent = new Intent(context, mainActivityName);
89
93
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
90
94
  PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
91
95
  notification_icon = "@drawable/ic_notification";
@@ -107,6 +111,9 @@ public class GeofenceBroadcastReceiver extends BroadcastReceiver {
107
111
  };
108
112
  int notificationId = UUID.randomUUID().hashCode();
109
113
  notificationManager.notify(notificationId, notificationBuilder.build());
114
+ } catch (ClassNotFoundException e) {
115
+ throw new RuntimeException(e);
116
+ }
110
117
  }
111
118
 
112
119
  private void createNotificationChannel(Context context) {