Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix ShareActivity not launching from widget

ammarahm-ed3f3e375187db
diff --git a/apps/mobile/android/app/src/main/AndroidManifest.xml b/apps/mobile/android/app/src/main/AndroidManifest.xml
index cca909325..e4a132044 100644
--- a/apps/mobile/android/app/src/main/AndroidManifest.xml
+++ b/apps/mobile/android/app/src/main/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:theme="@style/BootTheme"
android:largeHeap="true"
android:usesCleartextTraffic="true">
- <receiver android:exported="true" android:name=".NoteWidget">
+ <receiver android:exported="false" android:name=".NoteWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@@ -73,6 +73,8 @@
android:noHistory="true"
android:screenOrientation="unspecified"
android:exported="true"
+ android:taskAffinity=""
+ android:excludeFromRecents="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/AppThemeB">
<intent-filter android:label="Make Note">
@@ -84,9 +86,7 @@
</intent-filter>
<intent-filter android:label="Make Note">
<action android:name="android.intent.action.PROCESS_TEXT" />
-
<category android:name="android.intent.category.DEFAULT" />
-
<data android:mimeType="text/*" />
</intent-filter>
</activity>
diff --git a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/NoteWidget.java b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/NoteWidget.java
index 74383bab3..b8af4ba7b 100644
--- a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/NoteWidget.java
+++ b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/NoteWidget.java
@@ -16,14 +16,11 @@ public class NoteWidget extends AppWidgetProvider {
int appWidgetId) {
Intent intent = new Intent(context, ShareActivity.class);
- PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
- ;
- CharSequence widgetText = context.getString(R.string.appwidget_text);
- // Construct the RemoteViews object
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.note_widget);
views.setOnClickPendingIntent(R.id.widget_button, pendingIntent);
- // Instruct the widget manager to update the widget
+
appWidgetManager.updateAppWidget(appWidgetId, views);
}