正在查看: bbinstant v6.24.0 应用的 NetworkconnectionChecker.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 NetworkconnectionChecker.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.adjetter.kapchatsdk;
import android.app.NotificationManager;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import com.adjetter.kapchatsdk.interfaces.CallBackResponse;
import com.bigbasket.bbinstant.core.payments.activity.ZetaSodexoActivity;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
public class NetworkconnectionChecker extends Service {
static final String CONNECTIVITY_CHANGE_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
boolean lastConnected = false;
NotificationManager manager;
BroadcastReceiver receiver;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(CONNECTIVITY_CHANGE_ACTION);
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try {
if (NetworkconnectionChecker.CONNECTIVITY_CHANGE_ACTION.equals(intent.getAction())) {
if (ConnectionHelper.isConnected(context)) {
XMPPTCPConnection xMPPTCPConnection = KapchatConnection.mConnection;
if ((xMPPTCPConnection == null || !xMPPTCPConnection.isConnected()) && !NetworkconnectionChecker.this.lastConnected && KapchatHelper.foregrounded()) {
KapchatHelper.initialise(NetworkconnectionChecker.this.getApplicationContext(), context.getSharedPreferences("kapchatpreference", 0).getString("customerCode", ""), context.getSharedPreferences("kapchatpreference", 0).getString("supportKey", ""), context.getSharedPreferences("kapchatpreference", 0).getString("encryptionKey", ""), new CallBackResponse() {
@Override
public void intialiseResponse(String str) {
StringBuilder sb = new StringBuilder();
sb.append("response ");
sb.append(str);
System.out.println("#### response " + str);
if (str.equalsIgnoreCase(ZetaSodexoActivity.ZETA_SDXO_TPIN_SUCCESS_TXT)) {
try {
NetworkconnectionChecker.this.stopSelf();
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
NetworkconnectionChecker.this.lastConnected = true;
}
} else {
NetworkconnectionChecker.this.lastConnected = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
};
this.receiver = broadcastReceiver;
registerReceiver(broadcastReceiver, intentFilter);
}
@Override
public void onDestroy() {
try {
unregisterReceiver(this.receiver);
} catch (Exception e) {
e.printStackTrace();
}
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
return 1;
}
}