1. Are you ready for the Galaxy S20? Here is everything we know so far!

Detect taps on case

Discussion in 'Android Apps & Games' started by rhosch, Oct 31, 2014.

  1. rhosch

    rhosch Lurker
    Thread Starter

    On galaxy alpha (forums still pretty empty), ATT bootloader locked so whatever I can accomplish stock for now.

    I'm trying to create way to detect and count taps on the case to launch a task while the phone is asleep. For now, the goal is something like three taps on phone back while in shirt pocket to call my wife on soeakerphone (mic seems to cope well enough with the pocket).


    Can't use Xperience etc without root.

    Detecting a front/back shake with very short duration and moderate sensitivity seems to work OK. Plenty of false detections, but my plan was to count and require say a group of three in one second to launch the task.

    So I set a variable 1 equal to time in milliseconds with a tap, variable 2 equal to time minus var 1, and var 3 equal to time minus var 2. If both var 2 and 3 are under a threshold, and/or their sum is below a threshold, launch task.

    Works, except.... the sampling rate seems too slow. I can seem to detect taps closer than about one second, which makes the action both awkward and too prone to random false triggers. Looking at the monitoring settings, I don't see how to affect this.

    Any ideas on how to fix what I'm doing, or suggestions on a better route entirely to take?
     



    1. Download the Forums for Android™ app!


      Download

       
  2. WarriusZero

    WarriusZero Guest

    I'm trying on a Nexus 4 what you describe here (just the 1 tap for now) and the success rate is catastrophic while the phone detects the shake almost every time I put the phone down. I'm not sure how you're going to make it work.

    Also, the main issue here is, I would say, that you're going to have to enable the accelerometer while the phone is asleep and that's going to drain your battery.
     
    codesplice likes this.
  3. rhosch

    rhosch Lurker
    Thread Starter

    Cool, a reply... thanks!

    Yeah, single tap is riddled with false detections which I expected. That's why I'm trying to count taps within a time window to significantly decrease inadvertent triggers. I'd say it works except again I can't seem to get the sampling rate or recovery rate or whatever you want to call it fast enough.

    I had figured there would be a battery hit but to be honest I don't think I've left accel on long enough to see how bad because the profile hasn't worked well enough. I figured if I accomplished getting across the first bridge then I could tackle that... perhaps enabling accel under certain contexts like when BT connected in car assuming tasker would allow that.
     

Tasker

Tasker Forum

net.dinglisch.android.taskerm

⚙No repetitive tasks for you, let your Android device handle it!⚙
Total Automation, From Settings to SMS. Here are only some
of the things you could do with Tasker. Its real power is the flexibility to combine contexts and tasks however you wish: https://tasker.joaoapps.com/exampleuses.htmlAutomations
Make your phone a true smart
phone! Why remember to change the volume every day when you leave home when your phone can do it for you? Automate stuff based on the app you're in
, the time of day
, your location
, your Wi-Fi network
, Received SMS or Calls
, the currently playing song
and many other (130+) states and events! Check out how easy it is to create an automation: https://www.youtube.com/watch?v=s6EAbLW5WSkActions
350+ actions allow you to truly customize your phone like never before! Send SMS, create notifications, change almost any system setting like Wifi Tether, Dark Mode, Always On Display, change any volume, control Do Not Disturb, open apps, file manipulation, control music playback, get your location... you get the idea. If you can think of it, Tasker can probably do it for you! Note: root is NOT (I repeat NOT) required for majority of the functions.
However, a few of the actions (like the Airplane Mode action and the Mobile Data action on some devices) require root. Regarding those few actions that do require root, this is because of Android security policies that developers cannot work around. ☑ Other Triggers
Manually trigger your actions via launcher shortcuts, quick setting tiles, widgets, long-pressing volume buttons, media buttons (like the ones on your BT headsets or headphones), Bixby button, Navigation Bar, Notificaitons and more! ☑ Join - Remote Tasker
Adding Join (https://play.google.com/store/apps/details?id=com.joaomgcd.join) to the mix will even allow you to trigger tasks from another Android device or PC! ☑ Scenes
Design your own UI and use it to display any info you want or trigger any task! ☑ App Creation
Create your own standalone apps to share or sell with the Tasker App Factory (https://play.google.com/store/apps/details?id=net.dinglisch.android.appfactory)! ☑ Developer Friendly
A lot of 3rd party developers already allow you to perform actions in their apps and listen to their events/states through Tasker! Check out a list of plugins https://tasker.joaoapps.com/pluginlist.html. You can also call most of the Web APIs from Tasker with the powerful HTTP Auth and HTTP Request actions! Check out an example https://youtu.be/yAt2D1XmgUI. ☑ 7 day trial - one time payment to unlock
Get it here: https://tasker.joaoapps.com/download.htmlUseful Links
Starter Guides: https://tasker.joaoapps.com/guides.html Pre-made projects: https://forum.joaoapps.com/index.php?resources/ Official Support Forumhttps://groups.google.com/forum/#!forum/tasker Community full of people willing to help: https://www.reddit.com/r/tasker/ It's not possible to fix problems reported via Play Store Comments so please use the "Report Issue To Developer" option in the app > Menu to do so. Note
: Tasker uses the BIND_DEVICE_ADMIN permission in order to provide the System Lock functionality

READ MORE
February 15, 2020
Last Updated
4.4
Rating
1M+
Installs
Loading...
Similar Threads - Detect taps case
  1. melani78
    Replies:
    2
    Views:
    257
  2. Daddyroid
    Replies:
    4
    Views:
    2,495
  3. RU2022
    Replies:
    3
    Views:
    801
  4. JSS1900
    Replies:
    8
    Views:
    2,117
  5. hzare
    Replies:
    1
    Views:
    890
  6. Yamil_alv
    Replies:
    1
    Views:
    3,068
  7. Bhavin Lathia
    Replies:
    4
    Views:
    2,876
  8. Rasil1127
    Replies:
    2
    Views:
    3,120
  9. App Update
    Replies:
    1
    Views:
    880
  10. kiranmatrixlee
    Replies:
    0
    Views:
    2,521

Share This Page

Loading...