Skip to content

Commit

Permalink
修改主函数相关代码,提升美观性
Browse files Browse the repository at this point in the history
  • Loading branch information
Hny0305Lin committed Jul 2, 2024
1 parent 6045ca7 commit eb3941d
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.os.Vibrator;

import com.haohanyh.linmengjia.nearlink.nlchat.ch34x.CH34xUARTDriver;

public class MainAPP extends Application {
@SuppressLint("StaticFieldLeak")
public static CH34xUARTDriver CH34X; //需要将CH34x的驱动类写在APP类下面,使得帮助类的生命周期与整个应用程序的生命周期是相同的

/**
* 手机震动提醒
*/
public static void Vibrate(Context context) {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator != null) {
long[] pattern = {0, 75, 37, 50};
vibrator.vibrate(pattern, -1);
}
}
}

0 comments on commit eb3941d

Please sign in to comment.