Files
assistant-android/app/src/main/java/com/gh/gamecenter/receiver/DownloadReceiver.java
2024-04-12 14:52:46 +08:00

40 lines
1.3 KiB
Java

package com.gh.gamecenter.receiver;
import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_DOWNLOAD;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.DownloadNotificationHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.utils.ToastUtils;
/**
* Created by LGT on 2016/10/10.
* notification下载跳转
*/
public class DownloadReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
ExtensionsKt.doOnMainProcessOnly(() -> {
try {
if (DownloadNotificationHelper.ACTION_VDOWNLOAD.equals(intent.getAction())) {
DirectUtils.directToVGameDownload(context, "其他", true);
} else {
DirectUtils.directToDownloadManager(context, ENTRANCE_DOWNLOAD);
}
} catch (NullPointerException exception) {
// "unknown reason", 系统内部的错误
if (exception.getMessage() != null) {
ToastUtils.toast(exception.getMessage());
}
}
return null;
});
}
}