Open Lir10 opened 6 years ago
Very interesting question, I tried the same code on an Honor 8 - does not work - and a Nexus 6 - does work - ... Is there any insight on this ?
@mathieudebrito As i have tested more it looks like most of the chinese phones doesn't work with this API. Any ideas?
I used ActivityRecognitionClient to request update activity transition and receive result in pending intent broadcast receiver. It works well on nexus 6 android nougat, but on samsung note 8 Android Oreo seem does not work.
I think Google doesn't test on devices plenty. Nexus and Pixel phones actually seem like no problem. But for other phones, even installed latest play service, it's not working yet.
i also faced that problem too on oppo F7 running andoird O, when app killed the foreground service will kill too.
I tried the Google codelab example on my Samsung S8+ and it does not work: https://github.com/googlecodelabs/activity_transitionapi-codelab Can someone give a pointer on how to debug this? I thought about buying another cheap Android 9 or 10 phone for development, but this ticket does not sound very promising :(
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 dont need to register broadcast receiver in Manifest.
@Override protected void onStart() { super.onStart(); IntentFilter intentFilter=new IntentFilter(Constants.BROADCAST_DETECTED_ACTIVITY); intentFilter.addCategory(Intent.CATEGORY_DEFAULT); registerReceiver(broadcastReceiver,intentFilter);
}
Samsung SM-A730F - android 9:🚫 not working Samsung SM-G965F - android 10:🚫 not working Samsung SM-G781U1 - android 10:🚫 not working Samsung SM-A307FN - android 10:✅ working one plus IN2011 - android 10: ✅ working
all phones have a gyroscope, accelerometer, etc.
For Huawei, we needed to add custom permissions. It worked when I added it.
<uses-permission android:name="com.huawei.hms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
@j-shiraishi Interesting, I wonder why the implementation is different for Huawei devices. And if that's the case - this should be added to the Activity Recognition docs as well
In some devices such as Huawei p8 lite and Galaxy A3 2016/2014 Activity Recognition doesn't work
is there any required hardware that needed for this API to work ?
both of the devices don't have gyro sensor
Thanks