Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extra checks and option to save result to SharedPreferences #15

Merged
merged 18 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Environment;
import android.support.v7.app.AlertDialog;
import android.util.Base64;
Expand Down Expand Up @@ -144,4 +146,11 @@ static boolean isDebug(Context context) {
return ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
}

static boolean isConnectedToInternet(Context context) {
Copy link
Owner

@javiersantos javiersantos Mar 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectivityManager will check if the user has WiFi or data enabled. If LuckyPatcher or any other patcher uses an offline mode, this method will return true because the device is connected to the Internet.

This method doesn't fix the issue reported by @franciscofranco , since the license checker will return "Allow" when the user is connected to the Internet and using a simple bypass by LuckyPatcher (offline mode).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind if I ask you for a suggestion?

ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context
.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ public void dontAllow(int reason) {
public void applicationError(int errorCode) {
// TODO: Check this, from my personal experience, the license is verified
// TODO: without this permission.
if (errorCode == ERROR_MISSING_PERMISSION) {
if ((errorCode == ERROR_MISSING_PERMISSION) &&
LibraryUtils.isConnectedToInternet(context)) {
doExtraVerification(verifyCallback, true);
} else {
verifyCallback.onError(PiracyCheckerUtils.getCheckerErrorFromCode
Expand Down