Fixing shortcuts for native hardware.
This commit is contained in:
parent
f850026304
commit
6e16a093e8
Binary file not shown.
@ -17,6 +17,7 @@
|
|||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<action android:name="android.content.Intent.ACTION_CREATE_SHORTCUT" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -84,7 +84,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Intent targetIntent = new Intent(MainActivity.this.getApplicationContext(), MainActivity.class);
|
Intent targetIntent = new Intent(MainActivity.this.getApplicationContext(), MainActivity.class);
|
||||||
targetIntent.setAction(Intent.ACTION_DEFAULT);
|
targetIntent.setAction(Intent.ACTION_VIEW);
|
||||||
targetIntent.putExtra("url", url);
|
targetIntent.putExtra("url", url);
|
||||||
Log.w("BurguillosInfo", "Created intent " + url + " " + shortLabel);
|
Log.w("BurguillosInfo", "Created intent " + url + " " + shortLabel);
|
||||||
|
|
||||||
@ -100,17 +100,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
.build();
|
.build();
|
||||||
Log.w("BurguillosInfo", "Built pin.");
|
Log.w("BurguillosInfo", "Built pin.");
|
||||||
|
|
||||||
Intent pinnedShortcutCallbackIntent =
|
shortcutManager.requestPinShortcut(pinShortcutInfo, null);
|
||||||
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());
|
|
||||||
Log.w("BurguillosInfo", "added request pin.");
|
Log.w("BurguillosInfo", "added request pin.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user