how to detect screen casters android, detect tap pressure

丶灬走出姿态 提交于 2019-12-12 14:15:32

问题


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


回答1:


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);
    }

}


来源:https://stackoverflow.com/questions/6293294/how-to-detect-screen-casters-android-detect-tap-pressure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!