I\'m testing Activity Recognition API in 2 apps : Google sample code and implementation of this code in my app.
The problem is both apps keeps getting activity recognit
Even registering broadcast receiver in Manifest file,you need to register in dynamically in Oreo+ otherwise it will not work. Try this.Add this code in main activity or in startCommand in Service.It worked for me.I have tested this code on Android 10 too..worked perfectly.You need not to register broadcast receiver in Manifest file.
@Override
protected void onStart() {
super.onStart();
IntentFilter intentFilter=new IntentFilter(Constants.BROADCAST_DETECTED_ACTIVITY);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
registerReceiver(broadcastReceiver,intentFilter);
}