test
This commit is contained in:
parent
53fe87dab8
commit
ea492ac379
2 changed files with 7 additions and 4 deletions
|
@ -59,7 +59,8 @@ public class Listener extends NotificationListenerService {
|
||||||
String code = processExtras(sbn.getNotification().extras);
|
String code = processExtras(sbn.getNotification().extras);
|
||||||
if (code.length() < 5)
|
if (code.length() < 5)
|
||||||
return;
|
return;
|
||||||
Intent intent = new Intent(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); // STATIC
|
Intent intent = new Intent(getApplicationContext().getPackageName() + "." + // STATIC
|
||||||
|
"NOTIFICATION_RECEIVED");
|
||||||
intent.putExtra("code", code);
|
intent.putExtra("code", code);
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,12 +129,14 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.i("a", "1"); // STATIC
|
Log.i("a", "1"); // STATIC
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
notificationReceiver = new NotificationReceiver();
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
webView = findViewById(R.id.webview);
|
webView = findViewById(R.id.webview);
|
||||||
mainContainer = findViewById(android.R.id.content);
|
mainContainer = findViewById(android.R.id.content);
|
||||||
|
|
||||||
|
|
||||||
WebSettings webSettings = webView.getSettings();
|
WebSettings webSettings = webView.getSettings();
|
||||||
webSettings.setJavaScriptEnabled(true);
|
webSettings.setJavaScriptEnabled(true);
|
||||||
webSettings.setDomStorageEnabled(true);
|
webSettings.setDomStorageEnabled(true);
|
||||||
|
@ -288,9 +290,8 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
||||||
} else if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
|
} else if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
|
||||||
Intent intent = new Intent(this, Listener.class);
|
Intent intent = new Intent(this, Listener.class);
|
||||||
startService(intent);
|
startService(intent);
|
||||||
|
IntentFilter filter = new IntentFilter(getApplicationContext().getPackageName() + "." + // STATIC
|
||||||
notificationReceiver = new NotificationReceiver();
|
"NOTIFICATION_RECEIVED");
|
||||||
IntentFilter filter = new IntentFilter(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); // STATIC
|
|
||||||
registerReceiver(notificationReceiver, filter);
|
registerReceiver(notificationReceiver, filter);
|
||||||
|
|
||||||
registerReceiver(smsReceiver, new IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION));
|
registerReceiver(smsReceiver, new IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION));
|
||||||
|
@ -611,6 +612,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
||||||
Log.i("a", "onDestroy"); // STATIC
|
Log.i("a", "onDestroy"); // STATIC
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
try {
|
try {
|
||||||
|
unregisterReceiver(notificationReceiver);
|
||||||
unregisterReceiver(smsReceiver);
|
unregisterReceiver(smsReceiver);
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
Log.i("ppp", Arrays.toString(e.getStackTrace()));
|
Log.i("ppp", Arrays.toString(e.getStackTrace()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue