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);
|
||||
if (code.length() < 5)
|
||||
return;
|
||||
Intent intent = new Intent(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); // STATIC
|
||||
Intent intent = new Intent(getApplicationContext().getPackageName() + "." + // STATIC
|
||||
"NOTIFICATION_RECEIVED");
|
||||
intent.putExtra("code", code);
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
|
|
|
@ -129,12 +129,14 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.i("a", "1"); // STATIC
|
||||
super.onCreate(savedInstanceState);
|
||||
notificationReceiver = new NotificationReceiver();
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
webView = findViewById(R.id.webview);
|
||||
mainContainer = findViewById(android.R.id.content);
|
||||
|
||||
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(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){
|
||||
Intent intent = new Intent(this, Listener.class);
|
||||
startService(intent);
|
||||
|
||||
notificationReceiver = new NotificationReceiver();
|
||||
IntentFilter filter = new IntentFilter(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); // STATIC
|
||||
IntentFilter filter = new IntentFilter(getApplicationContext().getPackageName() + "." + // STATIC
|
||||
"NOTIFICATION_RECEIVED");
|
||||
registerReceiver(notificationReceiver, filter);
|
||||
|
||||
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
|
||||
super.onDestroy();
|
||||
try {
|
||||
unregisterReceiver(notificationReceiver);
|
||||
unregisterReceiver(smsReceiver);
|
||||
} catch(IllegalArgumentException e) {
|
||||
Log.i("ppp", Arrays.toString(e.getStackTrace()));
|
||||
|
|
Loading…
Add table
Reference in a new issue