Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
8f6f5a55
Commit
8f6f5a55
authored
Sep 30, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove local notifications
parent
a0a4dcac
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
329 deletions
+0
-329
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-15
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+0
-12
app/src/main/java/app/insti/notifications/NotificationEventReceiver.java
...va/app/insti/notifications/NotificationEventReceiver.java
+0
-63
app/src/main/java/app/insti/notifications/NotificationIntentService.java
...va/app/insti/notifications/NotificationIntentService.java
+0
-226
app/src/main/java/app/insti/notifications/NotificationServiceStarterReceiver.java
...sti/notifications/NotificationServiceStarterReceiver.java
+0
-13
No files found.
app/src/main/AndroidManifest.xml
View file @
8f6f5a55
...
...
@@ -85,21 +85,6 @@
</activity>
<service
android:name=
".notifications.NotificationIntentService"
android:enabled=
"true"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<receiver
android:name=
".notifications.NotificationEventReceiver"
/>
<receiver
android:name=
".notifications.NotificationServiceStarterReceiver"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<action
android:name=
"android.intent.action.TIMEZONE_CHANGED"
/>
<action
android:name=
"android.intent.action.TIME_SET"
/>
</intent-filter>
</receiver>
<service
android:name=
".InstiAppFirebaseMessagingService"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
...
...
app/src/main/java/app/insti/activity/MainActivity.java
View file @
8f6f5a55
...
...
@@ -68,11 +68,9 @@ import app.insti.fragment.QuickLinksFragment;
import
app.insti.fragment.SettingsFragment
;
import
app.insti.fragment.TrainingBlogFragment
;
import
app.insti.fragment.UserFragment
;
import
app.insti.notifications.NotificationEventReceiver
;
import
okhttp3.Cache
;
import
okhttp3.OkHttpClient
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_BODY
;
...
...
@@ -84,8 +82,6 @@ import static app.insti.Constants.FCM_BUNDLE_NOTIFICATION_ID;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
app
.
insti
.
Constants
.
RESULT_LOAD_IMAGE
;
import
static
app
.
insti
.
notifications
.
NotificationIntentService
.
ACTION_OPEN_EVENT
;
public
class
MainActivity
extends
AppCompatActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
,
BackHandledFragment
.
BackHandlerInterface
{
...
...
@@ -153,20 +149,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
// Check for data passed by FCM
if
(
intent
.
getExtras
()
!=
null
&&
intent
.
getBundleExtra
(
Constants
.
MAIN_INTENT_EXTRAS
)
!=
null
)
{
handleFCMIntent
(
intent
.
getBundleExtra
(
Constants
.
MAIN_INTENT_EXTRAS
));
}
else
if
(
intent
.
getAction
()
!=
null
&&
intent
.
getAction
().
equals
(
ACTION_OPEN_EVENT
))
{
EventFragment
eventFragment
=
new
EventFragment
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
EVENT_JSON
,
intent
.
getStringExtra
(
Constants
.
EVENT_JSON
));
eventFragment
.
setArguments
(
bundle
);
updateFragment
(
eventFragment
);
}
else
{
handleIntent
(
intent
);
}
}
checkLatestVersion
();
NotificationEventReceiver
.
setupAlarm
(
getApplicationContext
());
}
private
void
fetchNotifications
()
{
...
...
app/src/main/java/app/insti/notifications/NotificationEventReceiver.java
deleted
100755 → 0
View file @
a0a4dcac
package
app.insti.notifications
;
import
android.app.AlarmManager
;
import
android.app.PendingIntent
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.util.Log
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
NotificationEventReceiver
extends
BroadcastReceiver
{
private
static
final
String
ACTION_START_NOTIFICATION_SERVICE
=
"ACTION_START_NOTIFICATION_SERVICE"
;
private
static
final
String
ACTION_DELETE_NOTIFICATION
=
"ACTION_DELETE_NOTIFICATION"
;
public
static
void
setupAlarm
(
Context
context
)
{
AlarmManager
alarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
PendingIntent
alarmIntent
=
getStartPendingIntent
(
context
);
alarmManager
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
getTriggerAt
(
new
Date
()),
1000
*
60
*
10
,
//Change this to 1000 * 60 for testing => runs every minute
alarmIntent
);
}
private
static
long
getTriggerAt
(
Date
now
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
now
);
//calendar.add(Calendar.HOUR, NOTIFICATIONS_INTERVAL_IN_HOURS);
return
calendar
.
getTimeInMillis
();
}
private
static
PendingIntent
getStartPendingIntent
(
Context
context
)
{
Intent
intent
=
new
Intent
(
context
,
NotificationEventReceiver
.
class
);
intent
.
setAction
(
ACTION_START_NOTIFICATION_SERVICE
);
return
PendingIntent
.
getBroadcast
(
context
,
0
,
intent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
}
public
static
PendingIntent
getDeleteIntent
(
Context
context
)
{
Intent
intent
=
new
Intent
(
context
,
NotificationEventReceiver
.
class
);
intent
.
setAction
(
ACTION_DELETE_NOTIFICATION
);
return
PendingIntent
.
getBroadcast
(
context
,
0
,
intent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
Intent
serviceIntent
=
null
;
if
(
ACTION_START_NOTIFICATION_SERVICE
.
equals
(
action
))
{
Log
.
i
(
getClass
().
getSimpleName
(),
"onReceive from alarm, starting notification service"
);
serviceIntent
=
NotificationIntentService
.
createIntentStartNotificationService
(
context
);
}
else
if
(
ACTION_DELETE_NOTIFICATION
.
equals
(
action
))
{
Log
.
i
(
getClass
().
getSimpleName
(),
"onReceive delete notification action, starting notification service to handle delete"
);
serviceIntent
=
NotificationIntentService
.
createIntentDeleteNotification
(
context
);
}
if
(
serviceIntent
!=
null
)
{
NotificationIntentService
.
enqueueWork
(
context
,
NotificationIntentService
.
class
,
200
,
serviceIntent
);
}
}
}
\ No newline at end of file
app/src/main/java/app/insti/notifications/NotificationIntentService.java
deleted
100755 → 0
View file @
a0a4dcac
This diff is collapsed.
Click to expand it.
app/src/main/java/app/insti/notifications/NotificationServiceStarterReceiver.java
deleted
100755 → 0
View file @
a0a4dcac
package
app.insti.notifications
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
public
final
class
NotificationServiceStarterReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
NotificationEventReceiver
.
setupAlarm
(
context
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment