360手机助手自动做了屏蔽处理。所以在360中设置允许本app获取设备码信息;
b. 本手机是android4.1.2版本,对于toast等信息提示做了更加严格的设置。如果需要显示toast信息,则要进行相关设置。进入设置/应用软件管理/xxapp/勾选显示通知框;
c. 为了避免toast被拦截的问题,可以考虑试用alert dialog来显示需要的信息,当然这个可能会降低用户体验,这个时候需要拿捏功能需求和用户体验的重要性。根据我的经验,功能需求的实现已经高于用户体验;
public static void forceUpdate() { Log.i(TAG, "forceUpdate"); // UmengUpdateAgent.forceUpdate(mActivity); UmengUpdateAgent.update(mActivity); UmengUpdateAgent.setUpdateAutoPopup(false); UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() { @Override public void onUpdateReturned(int updateStatus,UpdateResponse updateInfo) { switch (updateStatus) { case 0: // has update UmengUpdateAgent.showUpdateDialog(mActivity, updateInfo); Log.i(TAG, "forceUpdate1"); break; case 1: // has no update // Toast.makeText(mActivity, "当前已是最新版本", Toast.LENGTH_SHORT) // .show(); BaseHelper.showAlert(mActivity,"", "当前已是最新版本","确定"); Log.i(TAG, "forceUpdate2"); break; case 2: // none wifi // Toast.makeText(mActivity, "没有wifi连接, 只在wifi下更新", Toast.LENGTH_SHORT) // .show(); break; case 3: // time out // Toast.makeText(mActivity, "超时", Toast.LENGTH_SHORT) // .show(); BaseHelper.showAlert(mActivity,"", "版本检查超时,请稍候重试","确定"); Log.i(TAG, "forceUpdate3"); break; } } }); }
public static void showAlert(Context context,String title, String message,String confirmStr) { new AlertDialog.Builder(context) .setIcon(R.drawable.icon) .// 图标 setTitle(title) .// 标题 setMessage(message) .// 提示内容 setPositiveButton(confirmStr, new DialogInterface.OnClickListener() {// 确定 @Override public void onClick(DialogInterface arg0, int arg1) { // yes to do } }).show(); }