Post your feature requets for new triggers, conditions, actions and other improvements.
Moderator: Martin
-
Bluscre
- Posts: 145
- Joined: 31 Aug 2017 13:58
- Location: Germany
-
Contact:
Post
by Bluscre » 07 Sep 2017 18:43
But there are "workarounds" like
Code: Select all
public void detectScreenShotService(final Activity activity){
final Handler h = new Handler();
final int delay = 3000; //milliseconds
final ActivityManager am=(ActivityManager)activity.getSystemService(Context.ACTIVITY_SERVICE);
h.postDelayed(new Runnable(){
public void run(){
List<ActivityManager.RunningServiceInfo> rs=am.getRunningServices(200);
for(ActivityManager.RunningServiceInfo ar:rs){
if(ar.process.equals("com.android.systemui:screenshot")){
Toast.makeText(activity,"Screenshot captured!!",Toast.LENGTH_LONG).show();
}
}
h.postDelayed(this, delay);
}
}, delay);
}
From
https://stackoverflow.com/a/40218889
-
Martin
- Posts: 4468
- Joined: 09 Nov 2012 14:23
Post
by Martin » 09 Sep 2017 12:09
Hi,
Unfortunately Google removed this capability with Android 8 for apps like Automagic:
https://developer.android.com/reference ... vices(int)
You could also try to use
Notification on Statusbar Displayed to see if the 'screenshot captured' notification is posted by the system.
Regards,
Martin
-
Bluscre
- Posts: 145
- Joined: 31 Aug 2017 13:58
- Location: Germany
-
Contact:
Post
by Bluscre » 09 Sep 2017 13:08
Couldn't you just add a "Only working on Android 7.1 and below" notice like you did on some other triggers?
Most people still use 6.0-7.1 when looking at stats
Martin wrote:You could also try to use Notification on Statusbar Displayed to see if the 'screenshot captured' notification is posted by the system.
That wouldn't work since the different saving positions of screenshots on different devices :/
-
Martin
- Posts: 4468
- Joined: 09 Nov 2012 14:23
Post
by Martin » 09 Sep 2017 13:20
Sure, I'll add the notice to the condition in one of the next updates when I made some more tests on Android 8. Probably some other triggers, conditions and actions are also affected by new limitations imposed by Google.
The screenshot saving location will be hard to get since there's no official API available to detect it so you always have to test a few locations and check the timestamp of the files that could contain the screenshot. Using a file observer could work but also requires that you know the potential folders that are used to save the screenshots.