想要APK(安装包)的可以私聊我 我看到会第一时间发给你 (对此APP有其他想法的也欢迎沟通) 介绍:进入app页面如果有需要悬浮窗权限,显示在其他应用的上层把他打开,总而言之有要权限的就打开就OK了,可支持钉钉和企业微信调起(要先选择使用钉钉或是企业微信,默认是钉钉),两种方式吊起钉钉和企业微信,一种拨打电话方式(手机里面需要有电话卡),另一种方式设置调起时间,然后点击保存按钮后提示成功,按home键APP退到后台(不能杀死)生效,可以锁屏
特别注意!!! 保存时间的“:”为英文符号不是中文的,保存时间格式为24小时制,保存时间一次之后,每天就按照你设置的时间启动钉钉了,保存电话之后,你就可以使用保存的电话拨打仍在公司的电话,想更改电话或者时间重新输入电话号保存即可
主要代码:
public class BackGroundService extends Service { Notification notification; private Context mContext; private MediaPlayer bgmediaPlayer; private boolean isrun = true; public BackGroundService() { } @SuppressLint("NewApi") @Override public int onStartCommand(Intent intent, int flags, int startId) { mContext = this; Intent notificationIntent = new Intent(this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); //1.通知栏占用,不清楚的看官网或者音乐类APP的效果 notification = new Notification.Builder(mContext) .setContentTitle("GPS测试标题") .setContentText("GPS测试内容") .setSmallIcon(R.drawable.icon_bg) .setContentIntent(pendingIntent) .build(); startForeground(123456, notification); //2.开启线程(或者需要定时操作的事情) new Thread() { @Override public void run() { super.run(); while (isrun) { //你需要执行的任务 try { Thread.sleep(50000); // Thread.sleep(3000); } 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", "") + "")) { // Log.e("========type", SharedPreferencesUtil.get(mContext, "type", "") + ""); 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(); 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="https://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>
介绍:进入页面如果有需要悬浮窗权限,显示在其他应用的上层把他打开,总而言之有要权限的就打开就OK了,可支持钉钉和企业微信调起(要先选择使用钉钉或是企业微信,默认是钉钉),两种方式吊起钉钉和企业微信,一种拨打电话方式(手机里面需要有电话卡),另一种方式设置调起时间,然后点击保存按钮后提示成功,按home键APP退到后台(不能杀死)生效,可以锁屏
特别注意!!! 保存时间的“:”为英文符号不是中文的,保存时间格式为24小时制,保存时间一次之后,每天就按照你设置的时间启动钉钉了,保存电话之后,你就可以使用保存的电话拨打仍在公司的电话,想更改电话或者时间重新输入电话号保存即可 想要APK(安装包)的可以私聊我 我看到会第一时间发给你
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算