Fixing shortcuts for native hardware.

This commit is contained in:
Sergiotarxz 2023-08-30 01:06:15 +02:00
parent f850026304
commit 6e16a093e8
3 changed files with 3 additions and 12 deletions

View File

@ -17,6 +17,7 @@
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.content.Intent.ACTION_CREATE_SHORTCUT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

View File

@ -84,7 +84,7 @@ public class MainActivity extends AppCompatActivity {
return;
}
Intent targetIntent = new Intent(MainActivity.this.getApplicationContext(), MainActivity.class);
targetIntent.setAction(Intent.ACTION_DEFAULT);
targetIntent.setAction(Intent.ACTION_VIEW);
targetIntent.putExtra("url", url);
Log.w("BurguillosInfo", "Created intent " + url + " " + shortLabel);
@ -100,17 +100,7 @@ public class MainActivity extends AppCompatActivity {
.build();
Log.w("BurguillosInfo", "Built pin.");
Intent pinnedShortcutCallbackIntent =
shortcutManager.createShortcutResultIntent(pinShortcutInfo);
Log.w("BurguillosInfo", "created pin.");
PendingIntent successCallback = PendingIntent.getBroadcast(MainActivity.this, 0,
pinnedShortcutCallbackIntent,
PendingIntent.FLAG_IMMUTABLE);
Log.w("BurguillosInfo", "added success pin.");
shortcutManager.requestPinShortcut(pinShortcutInfo,
successCallback.getIntentSender());
shortcutManager.requestPinShortcut(pinShortcutInfo, null);
Log.w("BurguillosInfo", "added request pin.");
}
}