Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut API Android multiple applicationId

Tags:

android

So currently I added shortcuts to my app but I have two different package name for two different versions of my app. Using ${applicationId} inside shortcuts.xml does not work nor does a string resource reference. How do I point my targetPackage to point to the different applicationId to my productFlavors in my app?

like image 873
Bobby B Avatar asked Nov 10 '16 16:11

Bobby B


People also ask

What are app shortcuts in Android?

App Shortcuts were introduced in Android 7.1 (API level 25). App Shortcuts allow users to perform multiple actions within a short period of time with relatively less effort. Shortcuts let users quickly start common or recommended tasks within your app. You can have a maximum of five Shortcuts at a time for your application.

How to create shortcuts in Android with static shortcuts?

Here, android:resource will the source of your shortcuts. Create shortcuts.xml file under res/xml folder. Here, you can define all your static shortcuts. As you can see, the root element is <shortcuts>, inside which you can define multiple shortcuts using <shortcut> tag.

Should I use multiple APKs to build my Android app?

When trying to create an application that works across multiple generations of the Android platform, naturally you want your application to take advantage of new features on new devices, without sacrificing backwards compatibility. It may seem at the outset as though multiple APK support is the best solution, but this often isn’t the case.

How to create multiple APK charts on Android?

In order to create your multiple APK chart, start out with a row of cells representing the various API levels of the Android platform. Throw an extra cell at the end to represent future versions of Android. Now just color in the chart such that each color represents an APK.


1 Answers

How do I point my targetPackage to point to the different applicationId to my productFlavors in my app?

Have a different shortcut XML file in each of your product flavors' flavorname/src/res/xml/ directories.

Using ${applicationId} inside shortcuts.xml does not work

At present, that is only for the manifest.

nor does a string resource reference

Ideally, this would work, but is not supported at the present time.

like image 171
CommonsWare Avatar answered Oct 08 '22 08:10

CommonsWare