一款不用手动打卡,自动调起钉钉和企业微信上班打卡的App(更新篇)

 想要APK(安装包)的可以私聊我  我看到会第一时间发给你 (对此APP有其他想法的也欢迎沟通)

介绍:进入app页面如果有需要悬浮窗权限,显示在其他应用的上层把他打开,总而言之有要权限的就打开就OK了,可支持钉钉和企业微信调起(要先选择使用钉钉或是企业微信,默认是钉钉),两种方式吊起钉钉和企业微信,一种拨打电话方式(手机里面需要有电话卡),另一种方式设置调起时间,然后点击保存按钮后提示成功,按home键APP退到后台(不能杀死)生效,可以锁屏
特别注意!!! 保存时间的“:”为英文符号不是中文的,保存时间格式为24小时制,保存时间一次之后,每天就按照你设置的时间启动钉钉了,保存电话之后,你就可以使用保存的电话拨打仍在公司的电话,想更改电话或者时间重新输入电话号保存即可 

主要代码:




public class BackGroundService extends Service {
    private Context mContext;
    private MediaPlayer bgmediaPlayer;
    private boolean isrun = true;
    private NotificationManager notificationManager;
    private int NOTIFICATION = R.string.notification_live_start;

    public BackGroundService() {

    }

    @Override
    public void onCreate() {
        super.onCreate();
        notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    }

    @SuppressLint("NewApi")
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        mContext = this;
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
        builder.setSmallIcon(R.mipmap.ic_launcher);
        builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
        // 【适配Android8.0】设置Notification的Channel_ID,否则不能正常显示
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder.setChannelId("notification_id");
        }

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            NotificationChannel channel = new NotificationChannel("notification_id", "notification_name", NotificationManager.IMPORTANCE_LOW);
            notificationManager.createNotificationChannel(channel);
        }
        startForeground(1, builder.build());
        new Thread() {
            @Override
            public void run() {
                super.run();
                while (isrun) {
                    try {
                        Thread.sleep(50000);
                    } catch (InterruptedException es) {
                        es.printStackTrace();
                    }
                    String s = getSystemTime() + "";
                    s = s.substring(0, 5);
                    Log.e("========s", s);
//                    Log.e("========time", SharedPreferencesUtil.get(mContext, "time", "") + "");
                    //在这里面设置你想启动钉钉的时间(这个第一种启动钉钉的方式)
                    if (s.equals(SharedPreferencesUtil.get(mContext, "time", "") + "")) {
                        if (String.valueOf(SharedPreferencesUtil.get(mContext, "type", "")).equals("com.alibaba.android.rimet")) {
                            Utils.openCLD("1", "com.alibaba.android.rimet", getBaseContext());
                        } else {
                            Utils.openCLD("2", "com.tencent.wework", getBaseContext());
                        }
                    } else if (s.equals("0" + SharedPreferencesUtil.get(mContext, "time", ""))) {
                        if (String.valueOf(SharedPreferencesUtil.get(mContext, "type", "")).equals("com.alibaba.android.rimet")) {
                            Utils.openCLD("1", "com.alibaba.android.rimet", getBaseContext());
                        } else {
                            Utils.openCLD("2", "com.tencent.wework", getBaseContext());
                        }
                    }
                }
            }
        }.start();
        if (bgmediaPlayer == null) {
            bgmediaPlayer = MediaPlayer.create(this, R.raw.silent);
            bgmediaPlayer.setLooping(true);
            bgmediaPlayer.start();
        }
        return Service.START_STICKY;
    }

    @Override
    public IBinder onBind(Intent intent) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    @Override
    public void onDestroy() {
        isrun = false;
        stopForeground(true);
        bgmediaPlayer.release();
        stopSelf();
        notificationManager.cancel(NOTIFICATION);
        super.onDestroy();
    }

    public static String getSystemTime() {
        return new SimpleDateFormat("kk:mm:ss").format(new Date(System.currentTimeMillis()));
    }
}

 



public class PhoneReceiver extends BroadcastReceiver {
    private static final String TAG = "message";
    private static boolean mIncomingFlag = false;
    private static String mIncomingNumber = null;

    @Override
    public void onReceive(Context context, Intent intent) {
        // 如果是拨打电话
        if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
            mIncomingFlag = false;
            String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
            Log.i(TAG, "call OUT:" + phoneNumber);
        } else {
            // 如果是来电
            TelephonyManager tManager = (TelephonyManager) context
                    .getSystemService(Service.TELEPHONY_SERVICE);
            switch (tManager.getCallState()) {
                case TelephonyManager.CALL_STATE_RINGING:
                    mIncomingNumber = intent.getStringExtra("incoming_number");
                    //用你的电话往这个手机打电话就可以(这个第二种启动钉钉的方式)
                    if (mIncomingNumber != null && mIncomingNumber.equals("你的电话号码")) {
                        if (String.valueOf(SharedPreferencesUtil.get(context, "type", "")).equals("com.alibaba.android.rimet")) {
                            Utils.openCLD("1", "com.alibaba.android.rimet", context);
                        } else {
                            Utils.openCLD("2", "com.tencent.wework", context);
                        }
                    }
                    break;
                case TelephonyManager.CALL_STATE_OFFHOOK:

                    break;
                case TelephonyManager.CALL_STATE_IDLE:

                    break;
            }
        }
    }
}


public class Utils {
    public static void openCLD(String type, String packageName, Context context) {
        PackageManager packageManager = context.getPackageManager();
        PackageInfo pi = null;
        try {
            if (type.equals("1")) {
                pi = packageManager.getPackageInfo("com.alibaba.android.rimet", 0);
            } else {
                pi = packageManager.getPackageInfo("com.tencent.wework", 0);
            }
        } catch (NameNotFoundException e) {
        }
        Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
        resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        resolveIntent.setPackage(pi.packageName);
        List<ResolveInfo> apps = packageManager.queryIntentActivities(resolveIntent, 0);
        ResolveInfo ri = apps.iterator().next();
        if (ri != null) {
            String className = ri.activityInfo.name;
            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            ComponentName cn = new ComponentName(packageName, className);
            intent.setComponent(cn);
//            context.startActivity(intent);
            PendingIntent pendingIntent =
                    PendingIntent.getActivity(context, 0, intent, 0);
            try {
                pendingIntent.send();
            } catch (PendingIntent.CanceledException e) {
                e.printStackTrace();
            }
        }
    }
}


//运行这个app在后台  有个保活机制   不手动杀死不会死掉
//调起钉钉这里提供两种方式 一种是打电话 一种是设置时间
public class MainActivity extends AppCompatActivity {
    private TextView tv_check, tv_time, tv_phone;
    private EditText et_time, et_phone;
    private Context context = this;
    private boolean type = true;

    @SuppressLint("NewApi")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (!Settings.canDrawOverlays(this)) {
            //若未授权则请求权限
            Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
            intent.setData(Uri.parse("package:" + getPackageName()));
            startActivityForResult(intent, 0);
        }
        Intent forgroundService = new Intent(this, BackGroundService.class);
        startService(forgroundService);
        initView();
    }

    private void initView() {
        tv_check = findViewById(R.id.tv_check);
        tv_time = findViewById(R.id.tv_time);
        tv_phone = findViewById(R.id.tv_phone);
        et_time = findViewById(R.id.et_time);
        et_phone = findViewById(R.id.et_phone);
        if (SharedPreferencesUtil.get(context, "check", "").equals("weixin")) {
            SharedPreferencesUtil.put(context, "type", "com.tencent.wework");
            type = false;
            tv_check.setText("当前使用企业微信");
        } else {
            SharedPreferencesUtil.put(context, "type", "com.alibaba.android.rimet");
            type = true;
            tv_check.setText("当前使用钉钉");
        }
        tv_check.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (type) {
                    SharedPreferencesUtil.put(context, "check", "weixin");
                    SharedPreferencesUtil.put(context, "type", "com.tencent.wework");
                    tv_check.setText("当前使用企业微信");
                    type = false;
                } else {
                    SharedPreferencesUtil.put(context, "check", "dingding");
                    SharedPreferencesUtil.put(context, "type", "com.alibaba.android.rimet");
                    tv_check.setText("当前使用钉钉");
                    type = true;
                }
            }
        });
        tv_time.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SharedPreferencesUtil.put(context, "time", et_time.getText().toString());
                Toast.makeText(context, "保存成功,按home键退到后台即可", Toast.LENGTH_SHORT).show();
                et_time.setText("");
            }
        });
        tv_phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SharedPreferencesUtil.put(context, "phone", et_phone.getText().toString());
                Toast.makeText(context, "保存成功,按home键退到后台即可", Toast.LENGTH_SHORT).show();
                et_phone.setText("");
            }
        });
    }
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fff"
    android:orientation="vertical"
    android:padding="10dp">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#fff"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="介绍:进入页面如果有需要悬浮窗权限,显示在其他应用的上层把他打开,总而言之有要权限的就打开就OK了,可支持钉钉和企业微信调起(要先选择使用钉钉或是企业微信,默认是钉钉),两种方式吊起钉钉和企业微信,一种拨打电话方式(手机里面需要有电话卡),另一种方式设置调起时间,然后点击保存按钮后提示成功,按home键APP退到后台(不能杀死)生效"
                android:textColor="#000" />

            <TextView
                android:id="@+id/tv_check"
                android:layout_width="match_parent"
                android:layout_height="55dp"
                android:layout_marginTop="10dp"
                android:background="#E5d"
                android:gravity="center"
                android:text="当前使用钉钉"
                android:textColor="#fff" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="保存时间输入示例:8:30"
                android:textColor="#e57" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="保存电话输入示例:15546360000"
                android:textColor="#e57" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="特别注意!!! 保存时间的“:”为英文符号不是中文的,保存时间格式为24小时制,保存时间一次之后,每天就按照你设置的时间启动钉钉了,保存电话之后,你就可以使用保存的电话拨打仍在公司的电话,想更改电话或者时间重新输入电话号保存即可"
                android:textColor="#e57" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:orientation="horizontal">

                <EditText
                    android:id="@+id/et_time"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:hint="请输入时间"
                    android:textColor="#666"
                    android:textColorHint="#999" />

                <TextView
                    android:id="@+id/tv_time"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="2"
                    android:background="#E5d"
                    android:gravity="center"
                    android:text="保存调起时间"
                    android:textColor="#fff" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:orientation="horizontal">

                <EditText
                    android:id="@+id/et_phone"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:hint="请输入手机号码"
                    android:textColor="#666"
                    android:textColorHint="#999" />

                <TextView
                    android:id="@+id/tv_phone"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="2"
                    android:background="#E5d"
                    android:gravity="center"
                    android:text="保存拨打电话号(非本机号码)"
                    android:textColor="#fff" />
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

AndroidManifest


        <receiver android:name=".PhoneReceiver">
            <intent-filter android:priority="1000">
                <action android:name="android.intent.action.PHONE_STATE" />
            </intent-filter>
        </receiver>

        <service
            android:name=".BackGroundService"
            android:enabled="true"
            android:exported="true" />
        <activity android:name=".MoneyActivity"></activity>
介绍:进入页面如果有需要悬浮窗权限,显示在其他应用的上层把他打开,总而言之有要权限的就打开就OK了,可支持钉钉和企业微信调起(要先选择使用钉钉或是企业微信,默认是钉钉),两种方式吊起钉钉和企业微信,一种拨打电话方式(手机里面需要有电话卡),另一种方式设置调起时间,然后点击保存按钮后提示成功,按home键APP退到后台(不能杀死)生效,可以锁屏
特别注意!!! 保存时间的“:”为英文符号不是中文的,保存时间格式为24小时制,保存时间一次之后,每天就按照你设置的时间启动钉钉了,保存电话之后,你就可以使用保存的电话拨打仍在公司的电话,想更改电话或者时间重新输入电话号保存即可 


想要APK(安装包)的可以私聊我  我看到会第一时间发给你    
  • 25
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 182
    评论
以下是一个用 Shell 脚本自动微信千峰小程序上的示例: ```shell #!/bin/bash # 请在下面填入你的登录凭据和打信息 USERNAME="your_username" PASSWORD="your_password" LOCATION="your_location" # 登录微信 /Applications/WeChat.app/Contents/MacOS/WeChat -login -u $USERNAME -p $PASSWORD # 等待微信启动并扫码登录 sleep 10 # 启动微信小程序 # 请根据你的实际情况修改下面的命令,确保微信小程序在 Dock 中的位置 open -a WeChat && sleep 5 && osascript -e 'tell application "System Events" to tell process "WeChat" to click menu item "千峰小程序" of menu "Window" of menu bar 1' # 等待小程序启动 sleep 10 # 定位到打页面 osascript -e 'tell application "System Events" to tell process "WeChat" to tell window 1 to tell web area 1 to set value of text field 1 to "'$LOCATION'"' # 点击打按钮 osascript -e 'tell application "System Events" to tell process "WeChat" to tell window 1 to tell web area 1 to click button 1' # 等待打完成 sleep 5 # 关闭微信 osascript -e 'tell application "System Events" to tell process "WeChat" to click menu item "退出登录" of menu 1 of menu bar item "WeChat" of menu bar 1' # 退出脚本 exit 0 ``` 请注意,这个脚本是基于 macOS 系统的,使用了微信客户端,因此你需要将微信客户端的路径 `/Applications/WeChat.app/Contents/MacOS/WeChat` 修改为你的实际路径。另外,根据你的实际情况,可能需要对脚本进行一些整。 请确保你已经安装了 WeChat 命令行工具,并且你已经登录了微信账号。运行脚本后,它将自动打开微信、进入千峰小程序、填写定位信息并点击打按钮,最后退出微信

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 182
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值