正在查看: EFFICIENT POS v1.5.7 应用的 NotificationBroadCast.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: EFFICIENT POS v1.5.7 应用的 NotificationBroadCast.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package dev.gtr.pos.broadCast;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import dev.gtr.pos.api.ApiClient;
import dev.gtr.pos.config.Constant;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class NotificationBroadCast extends BroadcastReceiver {
SharedPreferences sharedPreferences;
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getStringExtra("Clicked") != null) {
String stringExtra = intent.getStringExtra("Clicked");
getSeenNotification(stringExtra, context);
((NotificationManager) context.getSystemService("notification")).cancel(Integer.parseInt(stringExtra));
}
}
private void getSeenNotification(String str, Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences("LOGIN", 0);
this.sharedPreferences = sharedPreferences;
Constant.Token = sharedPreferences.getString("TOKEN", null);
Constant.ComId = this.sharedPreferences.getString("COMID", null);
Constant.uId = this.sharedPreferences.getString("UID", null);
ApiClient.getInstance(context).getApi().notifySeenNotification("Bearer " + Constant.Token, str, Constant.uId).enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response.isSuccessful()) {
Log.e("Notifry", "Success" + response.code());
} else {
Log.e("Notifry", "" + response.code());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable th) {
Log.e("Notifry", "" + th.toString());
}
});
}
}