The problem is that the fragment does not catch broadcast. In the fragment, so I register it. But in onResume I get null. Having rustled the Internet, I did not find anything intelligible. But if you put it in a separate file, and register in the manifest, then everything is fine to catch. I'm testing on API 18. What could be the problem?
private BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d("logba", "onReceive : "); if (intent.getAction().equals(KeyChain.ACTION_STORAGE_CHANGED)) { Log.d("logba", "onReceive : keychain"); } } }; @Override public void onResume() { super.onResume(); Log.d("logba", "onResume : register" + getContext().getApplicationContext().registerReceiver(receiver, new IntentFilter(KeyChain.ACTION_STORAGE_CHANGED))); } @Override public void onPause() { Log.d("logba", "onPause : unregister"); getContext().getApplicationContext().unregisterReceiver(receiver); super.onPause(); }
в onResume получаю null- decrypt please. - Vladyslav Matviienko