Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
fix(MicroG Support): Add stock app package name checking
Browse files Browse the repository at this point in the history
  • Loading branch information
YT-Advanced committed Mar 27, 2024
1 parent f448e4a commit fda6481
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public class MicroGPatch {
private static final String DONT_KILL_MY_APP_LINK = "https://dontkillmyapp.com";
private static final String MICROG_VENDOR = "app.revanced";
private static final String MICROG_PACKAGE_NAME = MICROG_VENDOR + ".android.gms";
private static final String MICROG_DOWNLOAD_LINK = "https://github.com/Revanced/GmsCore/releases/latest";
private static final String MICROG_DOWNLOAD_LINK = "https://github.com/YT-Advanced/GmsCore/releases/latest";
private static final Uri MICROG_PROVIDER = Uri.parse("content://" + MICROG_VENDOR + ".android.gsf.gservices/prefix");
private static final String YOUTUBE_MUSIC_PACKAGE_NAME = "com.google.android.apps.youtube.music";

private static void startIntent(Context context, String uriString, String... message) {
for (String string : message) {
Expand All @@ -34,6 +35,13 @@ private static void startIntent(Context context, String uriString, String... mes
}

public static void checkAvailability(@NonNull Context context) {
try {
context.getPackageManager().getPackageInfo(YOUTUBE_MUSIC_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException exception) {
LogHelper.printInfo(() -> "Stock YouTube Music was not found", exception);
ReVancedUtils.showToastLong("Please install Stock YouTube Music from Play Store");
}

try {
context.getPackageManager().getPackageInfo(MICROG_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public class MicroGPatch {
private static final String DONT_KILL_MY_APP_LINK = "https://dontkillmyapp.com";
private static final String MICROG_VENDOR = "app.revanced";
private static final String MICROG_PACKAGE_NAME = MICROG_VENDOR + ".android.gms";
private static final String MICROG_DOWNLOAD_LINK = "https://github.com/Revanced/GmsCore/releases/latest";
private static final String MICROG_DOWNLOAD_LINK = "https://github.com/YT-Advanced/GmsCore/releases/latest";
private static final Uri MICROG_PROVIDER = Uri.parse("content://" + MICROG_VENDOR + ".android.gsf.gservices/prefix");
private static final String YOUTUBE_PACKAGE_NAME = "com.google.android.youtube";

private static void startIntent(Context context, String uriString, String... message) {
for (String string : message) {
Expand All @@ -34,6 +35,13 @@ private static void startIntent(Context context, String uriString, String... mes
}

public static void checkAvailability(@NonNull Context context) {
try {
context.getPackageManager().getPackageInfo(YOUTUBE_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException exception) {
LogHelper.printInfo(() -> "Stock YouTube was not found", exception);
ReVancedUtils.showToastLong("Please reinstall your Stock YouTube from Play Store");
}

try {
context.getPackageManager().getPackageInfo(MICROG_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException exception) {
Expand Down

0 comments on commit fda6481

Please sign in to comment.