This works for me, based on preinstalled Apps.
If Assistant Go or Google Go versions are installed, definitely is an Android Go device.
In rare cases that these apps didn't come preinstalled we look for Gmail Go and also Youtube Go preinstalled.
Tested on Huawei Y5 Lite with Android 8.1 (Go).
public static boolean isAndroidGoEdition(Context context) {
final String GMAIL_GO = "com.google.android.gm.lite";
final String YOUTUBE_GO = "com.google.android.apps.youtube.mango";
final String GOOGLE_GO = "com.google.android.apps.searchlite";
final String ASSISTANT_GO = "com.google.android.apps.assistant";
boolean isGmailGoPreInstalled = isPreInstalledApp(context, GMAIL_GO);
boolean isYoutubeGoPreInstalled = isPreInstalledApp(context, YOUTUBE_GO);
boolean isGoogleGoPreInstalled = isPreInstalledApp(context, GOOGLE_GO);
boolean isAssistantGoPreInstalled = isPreInstalledApp(context, ASSISTANT_GO);
if(isGoogleGoPreInstalled | isAssistantGoPreInstalled){
return true;
}
if(isGmailGoPreInstalled && isYoutubeGoPreInstalled){
return true;
}
return false;
}
private static boolean isPreInstalledApp(Context context, String packageName){
try {
PackageManager pacMan = context.getPackageManager();
PackageInfo packageInfo = pacMan.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
if(packageInfo != null){
//Check if comes with the image OS
int mask = ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
return (packageInfo.applicationInfo.flags & mask) != 0;
}
} catch (PackageManager.NameNotFoundException e) {
//The app isn't installed
}
return false;
}