AZ_
AZ_

Reputation: 21899

how to detect screen casters android, detect tap pressure

I developed an app that is fun to play with but there are some naughty people who are vandalizing fun of other people by using different type of screen casters and then playing with automated scripts and cheating users.

here is a link to a very famous screen caster. but is there any way to detect it? I think I have read somewhere that I can get tap pressure on accelerometer in android.

please help

Upvotes: 3

Views: 1520

Answers (1)

AZ_
AZ_

Reputation: 21899

Sample Application

package com.pressure.detection;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

public class StartActivity extends Activity implements View.OnTouchListener {
    /** Called when the activity is first created. */

 private TextView tvConsole;

    @Override
    public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
 findViewById(R.id.root_layout).setOnTouchListener(this);

 tvConsole = (TextView)findViewById(R.id.txtConsole);
    }

    @Override
    public boolean onTouch(View view, MotionEvent mEvent) {
    tvConsole.setText("Pressure: "+mEvent.getPressure() );


 System.out.println("Hardware X " + mEvent.getXPrecision()
  * mEvent.getX());
 System.out.println("Hardware Y " + mEvent.getYPrecision()
  * mEvent.getY());
 return super.onTouchEvent(mEvent);
    }

}

Upvotes: 1

Related Questions