Samsung SDKs

  • Recommend useful replies to give out SEEDs and raise your level as well.
  • You can select the most useful reply as the Best Answer for your thread.
  • Share topics you want to discuss on Facebook or Twitter and earn SEEDs!
  • Share your knowledge by posting in threads that interest you.
Subscription preference

Notification emails are sent to your Samsung account email address.

* Email : anonymous@samsung.com

  

Close

overriding SPen button functionality

Forums View
Started by Newbie picrots , 0 Seed Mar 13, 2012 09:54 Posts : 4 View : 9284 Likes : 5
I was wandering if there is any way to override the functionality of the SPen's button through sPen or android SDK?

for instance for this functionality of the spen which is openning the sMemo  with double tap the screen while holding the spen's button, I'd like to override and use it to launch a 3rd party note taking app.
Post Reply
Board View
Newbie k.krolik , 180 Seed Mar 13, 2012 15:01 Post #1 2
Hello,

Double tap on the screen with stylus button pressed sends an intent, which opens the sMemo application. You can also register your application for this intent:

<intent-filter android:label="MyApp">
        <action android:name="android.intent.action.EDIT" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="application/vnd.diotek.papermemo" />
</intent-filter>

Note that it is NOT inculded to the official documentation and may change.

All the functions for using stylus button in your applications are part of Android SDK. You can access them using OnTouchListener. Stylus button support is limited to event.getMetaState() function on Android API up to 13 and event.getButtonState() on Android API 14 (for MotionEvent events).

Regards,
Karolina Krolik
Samsung Developers
Post Reply
Board View
Newbie yosofun , 70 Seed Mar 21, 2012 06:51 Post #2 1
  The Galaxy Note is currently just on API 14 or is it fragmented across several different versions? If it is just on API 14, then is there need to support other than .getButtonState()?
Originally posted by : k.krolik@

Hello,

Double tap on the screen with stylus button pressed sends an intent, which opens the sMemo application. You can also register your application for this intent:

<intent-filter android:label="MyApp">
        <action android:name="android.intent.action.EDIT" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="application/vnd.diotek.papermemo" />
</intent-filter>

Note that it is NOT inculded to the official documentation and may change.

All the functions for using stylus button in your applications are part of Android SDK. You can access them using OnTouchListener. Stylus button support is limited to event.getMetaState() function on Android API up to 13 and event.getButtonState() on Android API 14 (for MotionEvent events).

Regards,
Karolina Krolik
Samsung Developers

 
Post Reply
Board View
Newbie ashughes , 20 Seed Sep 19, 2012 03:55 Post #3 1
Simply using MotionEvent.getButtonState() on API 14 and up doesn't work with the S Pen while the pen is touching the screen. I can successfully determine if the side button is being pressed on the Lenovo ThinkPad Tablet running Android 4.04, but not on the Galaxy Note 10.1 or the Galaxy Note (both running Android 4).

I can detect the S Pen side button being pressed when the pen is hovering above the display, however if the side button is held down when the pen goes "down" (touches the display), NO touch events are ever reported. If the pen goes "down" without the side button being pressed, and while the pen is still "down" the side button is pressed I get an ACTION_CANCEL event and don't receive any more touch events.

While the side button is being pressed and the pen is down, the system seems to be listening for gestures such as "flick left" (for back) and "flick down" (for menu).

I noticed that in the S Pen SDK demo app, when using an SCanvasView instead of just a regular View (which is what I was using above), I was able to continue to get motion events if I press the S Pen side button while the pen was touching the display, but the system still listened for the gestures ("flick left", "flick down", etc) while I was drawing. This caused the "SPenSDK Demo Exit" dialog to appear while I was still drawing underneath it.

My concerns are:
1) I want my users to be able to hold the S Pen side button down and use the S Pen for alternate functionality (this is how the default Android API 14+ works, and how it works on both Lenovo and HTC active pen devices). For example, holding the side button and using the S Pen to circle something to perform selection.
2) I don't want the built-in Samsung S Pen gesture detection to detect "flick left" to be back and "flick down" to be menu, etc.

The S Pen SDK documentation states that there is support for detecting the S Pen side button in non-SCanvasView views, but that doesn't appear to be true.

Is there anything that I am overlooking? If not, could you please consider making this work like it was designed for Android API 14+. We've had many many requests from our users for this functionality (especially since it works fine on non-Samsung devices).

Thank you,
Andrew
Post Reply
Board View
Newbie biliogadafr , 20 Seed Nov 03, 2012 20:39 Post #4 1
If you press side button when drawing you can continue receive MotionEvents. Just use this code in onTouchEvent of your view.

this.getParent().requestDisallowInterceptTouchEvent(true);

But I still can't use side button as I want, because of other problems mentioned in your post.. It would be great to have something like "mSPenEventLibrary.disableAllSamsungsStuff()" . What a pity that we have no such magic method.

Regards.
 

This content has been quoted from ashughes@’s thought. (Link to original post)

Simply using MotionEvent.getButtonState() on API 14 and up doesn't work with the S Pen while the pen is touching the screen. I can successfully determine if the side button is being pressed on the Lenovo ThinkPad Tablet running Android 4.04, but not on the Galaxy Note 10.1 or the Galaxy Note (both running Android 4).

I can detect the S Pen side button being pressed when the pen is hovering above the display, however if the side button is held down when the pen goes "down" (touches the display), NO touch events are ever reported. If the pen goes "down" without the side button being pressed, and while the pen is still "down" the side button is pressed I get an ACTION_CANCEL event and don't receive any more touch events.

While the side button is being pressed and the pen is down, the system seems to be listening for gestures such as "flick left" (for back) and "flick down" (for menu).

I noticed that in the S Pen SDK demo app, when using an SCanvasView instead of just a regular View (which is what I was using above), I was able to continue to get motion events if I press the S Pen side button while the pen was touching the display, but the system still listened for the gestures ("flick left", "flick down", etc) while I was drawing. This caused the "SPenSDK Demo Exit" dialog to appear while I was still drawing underneath it.

My concerns are:
1) I want my users to be able to hold the S Pen side button down and use the S Pen for alternate functionality (this is how the default Android API 14+ works, and how it works on both Lenovo and HTC active pen devices). For example, holding the side button and using the S Pen to circle something to perform selection.
2) I don't want the built-in Samsung S Pen gesture detection to detect "flick left" to be back and "flick down" to be menu, etc.

The S Pen SDK documentation states that there is support for detecting the S Pen side button in non-SCanvasView views, but that doesn't appear to be true.

Is there anything that I am overlooking? If not, could you please consider making this work like it was designed for Android API 14+. We've had many many requests from our users for this functionality (especially since it works fine on non-Samsung devices).

Thank you,
Andrew

 
Post Reply