|
|
@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 导入文档
|
|
|
|
#### 导入文档
|
|
|
|
|
|
|
|
|
|
|
|
直接使用老师提供压缩包文档用Android studio打开,出现报错显示检测不到build.gradle文件
|
|
|
|
直接使用老师提供压缩包文档用Android studio打开,出现报错显示检测不到build.gradle文件
|
|
|
|
|
|
|
|
|
|
|
@ -18,4 +18,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### GTaskASyncTask.java修改
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
出现报错:80: 错误: 找不到符号
|
|
|
|
|
|
|
|
notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
|
|
|
|
|
|
|
|
^
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
分析原因:版本问题,新版本的安卓项目对notification.builder不兼容了,需要把showNotification函数进行修改
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
修改代码:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
|
|
|
private void showNotification(int tickerId, String content) {
|
|
|
|
|
|
|
|
PendingIntent pendingIntent;
|
|
|
|
|
|
|
|
if (tickerId != R.string.ticker_success) {
|
|
|
|
|
|
|
|
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
|
|
|
|
|
|
|
|
NotesPreferenceActivity.class), PendingIntent.FLAG_IMMUTABLE);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
|
|
|
|
|
|
|
|
NotesListActivity.class), PendingIntent.FLAG_IMMUTABLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Notification.Builder builder = new Notification.Builder(mContext)
|
|
|
|
|
|
|
|
.setAutoCancel(true)
|
|
|
|
|
|
|
|
.setContentTitle(mContext.getString(R.string.app_name))
|
|
|
|
|
|
|
|
.setContentText(content)
|
|
|
|
|
|
|
|
.setContentIntent(pendingIntent)
|
|
|
|
|
|
|
|
.setWhen(System.currentTimeMillis())
|
|
|
|
|
|
|
|
.setOngoing(true);
|
|
|
|
|
|
|
|
Notification notification=builder.getNotification();
|
|
|
|
|
|
|
|
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|