Skip to content

Commit

Permalink
v1.6.1版本
Browse files Browse the repository at this point in the history
  • Loading branch information
szvone committed May 17, 2019
1 parent 3992f6d commit 63afe8e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 22 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ V免签为完全开源项目,开源项目意味着作者没有任何收入来
+ 微信店员收款推送通知

## 更新记录
+ v1.6.1(2019.05.17)
+ 修复微信无法正常回调的问题

+ v1.6(2019.05.16)
+ 启用新方式监听到账通知,理论支持更多设备!

Expand Down
Binary file modified app/app-release.apk
Binary file not shown.
65 changes: 44 additions & 21 deletions app/src/main/java/com/vone/vmq/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.Manifest;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
Expand All @@ -11,13 +12,14 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.media.RingtoneManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
Expand Down Expand Up @@ -327,28 +329,49 @@ public void checkPush(View v){
// return;
// }



Notification mNotification;
NotificationManager mNotificationManager;
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

mNotification = new NotificationCompat.Builder(this)
// 设置小图标
.setSmallIcon(R.mipmap.ic_launcher)
.setTicker("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
// 设置标题
.setContentTitle("V免签测试推送")
// 设置内容
.setContentText("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
// 设置Notification提示铃声为系统默认铃声
.setSound(
RingtoneManager.getActualDefaultRingtoneUri(
getBaseContext(),
RingtoneManager.TYPE_NOTIFICATION))

// 点击Notification的时候自动移除
.build();
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//ChannelId为"1",ChannelName为"Channel1"
NotificationChannel channel = new NotificationChannel("1",
"Channel1", NotificationManager.IMPORTANCE_DEFAULT);
channel.enableLights(true); //是否在桌面icon右上角展示小红点
channel.setLightColor(Color.GREEN); //小红点颜色
channel.setShowBadge(true); //是否在久按桌面图标时显示此渠道的通知
mNotificationManager.createNotificationChannel(channel);

Notification.Builder builder = new Notification.Builder(this,"1"); //与channelId对应

mNotification = builder
// 设置小图标
.setSmallIcon(R.mipmap.ic_launcher)
.setTicker("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
// 设置标题
.setContentTitle("V免签测试推送")
// 设置内容
.setContentText("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
.build();
}else{
mNotification = new Notification.Builder(MainActivity.this)
// 设置小图标
.setSmallIcon(R.mipmap.ic_launcher)
.setTicker("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
// 设置标题
.setContentTitle("V免签测试推送")
// 设置内容
.setContentText("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")

// 设置Notification提示铃声为系统默认铃声
.setSound(
RingtoneManager.getActualDefaultRingtoneUri(
getBaseContext(),
RingtoneManager.TYPE_NOTIFICATION))

.build();
}

//Toast.makeText(MainActivity.this, "已推送信息,如果权限,那么将会有下一条提示!", Toast.LENGTH_SHORT).show();

Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/com/vone/vmq/NeNotificationService2.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ public void onNotificationPosted(StatusBarNotification sbn) {
//微信支付: 微信支付收款0.01元(朋友到店)
String[] tmp = text.split(":");
if (tmp.length==2){
if (tmp[0].equals("微信支付") || tmp[0].equals("微信收款助手") ){
if (tmp[0].equals("微信支付") || tmp[0].equals("微信收款助手") || tmp[0].equals("微信收款商业版")){
if (text.indexOf("微信支付收款")!=-1){
String money = getSubString(text,"微信支付收款","元");
if (money.indexOf("支付")!=-1){
money = getSubString(money+"元","微信支付收款","元");
}

Log.d(TAG, "onAccessibilityEvent: 匹配成功: 微信 到账 "+money);
appPush(1,Double.valueOf(money));
}else if (text.indexOf("店员消息")!=-1){
Expand Down

0 comments on commit 63afe8e

Please sign in to comment.