I followed this tutorial and updated some syntax. When I run on a virtual device (Pixel 2 Android 11) the app is installed. Tapping the button gives me the success toast "Successfully added stickers" and the stickers are added to my Gboard.
When I try installing the app on a physical device (also Pixel 2 Android 11) the app is installed, I get the same successful toast, but the stickers are nowhere to be found in Gboard. This seems to be a common problem in the comments of that tutorial post, but no answers are given by the writer.
What might be the core issue for why the stickers aren't showing up in Gboard on physical devices?
EDIT: I should add that the app is being installed on physical devices via Internal Testing, not in a debugging environment. I haven't had access to a physical Android device this week.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyra.sooperturkeystickerpack">
<!-- Grant the AppIndexingUpdateService permission and enable it to run after being triggered -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.lyra.sooperturkeystickerpack.HomeActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="mystickers"/>
<data android:host="sooperturkeystickerpack"/>
</intent-filter>
</activity>
<service
android:name="com.lyra.sooperturkeystickerpack.AppIndexingUpdateService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
</application>
</manifest>
AppIndexingUpdateService
public class AppIndexingUpdateService extends JobIntentService {
// Job-ID must be unique across your whole app.
private static final int UNIQUE_JOB_ID = 42;
public static void enqueueWork(Context context) {
enqueueWork(context, AppIndexingUpdateService.class, UNIQUE_JOB_ID, new Intent());
}
@Override
protected void onHandleWork(@NonNull Intent intent) {
AppIndexingUtil.setStickers(getApplicationContext(), FirebaseAppIndex.getInstance());
}
}
AppIndexingUtil
public class AppIndexingUpdateService extends JobIntentService {
// Job-ID must be unique across your whole app.
private static final int UNIQUE_JOB_ID = 42;
public static void enqueueWork(Context context) {
enqueueWork(context, AppIndexingUpdateService.class, UNIQUE_JOB_ID, new Intent());
}
@Override
protected void onHandleWork(@NonNull Intent intent) {
AppIndexingUtil.setStickers(getApplicationContext(), FirebaseAppIndex.getInstance());
}
}
HomeActivity
public class HomeActivity extends Activity {
Button mBtnAddSticker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
mBtnAddSticker = findViewById(R.id.btn_add_sticker);
mBtnAddSticker.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AppIndexingUpdateService.enqueueWork(HomeActivity.this);
}
});
}
}
Sticker
public class Sticker {
private String mURL;
public Sticker(String url) {
this.mURL = url;
}
public String getURL() {
return mURL;
}
public void setURL(String mURL) {
this.mURL = mURL;
}
}
StickersDataFactory
public class StickersDataFactory {
public static List<Sticker> getAllStickerReference() {
String[] stickerURLRef = {
"https://firebasestorage.googleapis.com/v0/b/sooperturkey-sticker-pac-b4f0f.appspot.com/o/ssp_10.png?alt=media&token=87a1a3b9-35df-419b-9a4a-c32c9ddd9c0b",
"https://firebasestorage.googleapis.com/v0/b/sooperturkey-sticker-pac-b4f0f.appspot.com/o/ssp_10.png?alt=media&token=87a1a3b9-35df-419b-9a4a-c32c9ddd9c0b",
"https://firebasestorage.googleapis.com/v0/b/sooperturkey-sticker-pac-b4f0f.appspot.com/o/ssp_1.png?alt=media&token=b4998d0c-5383-4c70-bcfd-05ca4a3cc0a7",
"https://firebasestorage.googleapis.com/v0/b/sooperturkey-sticker-pac-b4f0f.appspot.com/o/ssp_2.png?alt=media&token=cc6a371e-7bae-412d-9959-23f82ae507e2",
"https://firebasestorage.googleapis.com/v0/b/sooperturkey-sticker-pac-b4f0f.appspot.com/o/ssp_3.png?alt=media&token=05cb74b2-47d8-4467-b20b-d0b6eb459f29",
"https://firebasestorage.googleapis.com/v0/b/sooperturkey-sticker-pac-b4f0f.appspot.com/o/ssp_4.png?alt=media&token=e2c3141d-68b2-4311-9174-0bcf49494467"
};
List<Sticker> stickerList = new ArrayList<>();
for (int i = 0; i < stickerURLRef.length; i++) {
stickerList.add(new Sticker(stickerURLRef[i]));
}
return stickerList;
}
}