feat(appbase): 优化快捷方式配置与崩溃日志分享功能
1. 快捷方式改为静态XML配置(仅beta渠道)
- 新增 res/xml/shortcuts.xml 定义静态快捷方式
- AndroidManifest.xml 添加 meta-data 引用
- MainActivity.setupShortcuts() 移除动态注册代码
2. 崩溃日志分享功能增强
- CrashHandleNotifyUtils: 新增 appAPKName/emailTo 参数
- ShareLogActivity: 添加邮件接收者(EXTRA_EMAIL)支持
- 邮件标题格式: {应用名} - 崩溃日志
- 邮件内容添加应用版本号和设备运行环境信息
- 通知按钮名称改为: 发送日志给开发组
3. 调用方适配
- App.java: 传入 APPBase 和 studio@winboll.cc
This commit is contained in:
@@ -55,7 +55,9 @@ public class App extends GlobalApplication {
|
||||
this,
|
||||
getPackageName(),
|
||||
stackTraceStr,
|
||||
CrashActivity.class
|
||||
CrashActivity.class,
|
||||
"APPBase",
|
||||
"studio@winboll.cc"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package cc.winboll.studio.appbase;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.pm.ShortcutManager;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
@@ -69,31 +65,11 @@ public class MainActivity extends Activity {
|
||||
/**
|
||||
* 注册桌面图标静态快捷方式
|
||||
* 长按桌面图标后显示快捷菜单,点击可直接打开异常邮件接收设置页面
|
||||
* 静态快捷方式已通过 res/xml/shortcuts.xml 配置,此处无需动态注册
|
||||
*/
|
||||
private void setupShortcuts() {
|
||||
if (!"cc.winboll.studio.appbase.beta".equals(getPackageName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
|
||||
if (shortcutManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, APPExcetionMailSettingsActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "exception_mail_settings")
|
||||
.setShortLabel("邮件设置")
|
||||
.setLongLabel("异常邮件接收设置")
|
||||
.setIcon(Icon.createWithResource(this, R.drawable.ic_winboll))
|
||||
.setIntent(intent)
|
||||
.build();
|
||||
|
||||
shortcutManager.setDynamicShortcuts(
|
||||
java.util.Arrays.asList(shortcut)
|
||||
);
|
||||
// 静态快捷方式仅在 beta 渠道生效,通过 AndroidManifest.xml 中的 meta-data 配置
|
||||
// beta 渠道使用 res/xml/shortcuts.xml 定义快捷方式
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user