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
c4dd53d3
Commit
c4dd53d3
authored
Jul 11, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FCM push notifications
parent
6c2fa89e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
22 deletions
+46
-22
app/build.gradle
app/build.gradle
+1
-0
app/google-services.json
app/google-services.json
+7
-7
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-14
app/src/main/java/app/insti/InstiAppFirebaseMessagingService.java
...main/java/app/insti/InstiAppFirebaseMessagingService.java
+20
-0
app/src/main/java/app/insti/LoginActivity.java
app/src/main/java/app/insti/LoginActivity.java
+13
-1
app/src/main/java/app/insti/api/RetrofitInterface.java
app/src/main/java/app/insti/api/RetrofitInterface.java
+3
-0
No files found.
app/build.gradle
View file @
c4dd53d3
...
...
@@ -38,6 +38,7 @@ ext {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
'com.android.support:support-v4:27.1.1'
implementation
'com.google.firebase:firebase-messaging:17.1.0'
androidTestImplementation
(
'com.android.support.test.espresso:espresso-core:2.2.2'
,
{
exclude
group:
'com.android.support'
,
module:
'support-annotations'
})
...
...
app/google-services.json
View file @
c4dd53d3
{
"project_info"
:
{
"project_number"
:
"
306601329049
"
,
"firebase_url"
:
"https://
iitb-app-5c0aa
.firebaseio.com"
,
"project_id"
:
"
iitb-app-5c0aa
"
,
"storage_bucket"
:
"
iitb-app-5c0aa
.appspot.com"
"project_number"
:
"
259853447628
"
,
"firebase_url"
:
"https://
astral-theory-207617
.firebaseio.com"
,
"project_id"
:
"
astral-theory-207617
"
,
"storage_bucket"
:
"
astral-theory-207617
.appspot.com"
},
"client"
:
[
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:
306601329049:android:950a72a311331b9
c"
,
"mobilesdk_app_id"
:
"1:
259853447628:android:efaea50ea28ccfe
c"
,
"android_client_info"
:
{
"package_name"
:
"app.insti"
}
},
"oauth_client"
:
[
{
"client_id"
:
"
306601329049-6v597vrdv0nbi15ehpehq8hiaek8unqp
.apps.googleusercontent.com"
,
"client_id"
:
"
259853447628-be3teletcqtfpfddj9qnk0bqj221h2mo
.apps.googleusercontent.com"
,
"client_type"
:
3
}
],
"api_key"
:
[
{
"current_key"
:
"AIzaSy
C1oThCMZN3JMnK6MUTJRjkp47q1K_gnTA
"
"current_key"
:
"AIzaSy
B8B7N-3hnW_u4jOXHLRUzbMl6To3aDyJo
"
}
],
"services"
:
{
...
...
app/src/main/AndroidManifest.xml
View file @
c4dd53d3
...
...
@@ -76,23 +76,11 @@
</receiver>
<service
android:name=
"app.insti.gcm.MyGcmListenerService"
android:exported=
"false"
>
android:name=
".InstiAppFirebaseMessagingService"
>
<intent-filter>
<action
android:name=
"com.google.
android.c2dm.intent.RECEIVE"
/>
<action
android:name=
"com.google.
firebase.MESSAGING_EVENT"
/>
</intent-filter>
</service>
<service
android:name=
"app.insti.gcm.MyInstanceIDListenerService"
android:exported=
"false"
>
<intent-filter>
<action
android:name=
"com.google.android.gms.iid.InstanceID"
/>
</intent-filter>
</service>
<service
android:name=
"app.insti.gcm.RegistrationIntentService"
android:exported=
"false"
></service>
</application>
...
...
app/src/main/java/app/insti/InstiAppFirebaseMessagingService.java
0 → 100644
View file @
c4dd53d3
package
app.insti
;
import
android.util.Log
;
import
com.google.firebase.messaging.FirebaseMessagingService
;
import
com.google.firebase.messaging.RemoteMessage
;
public
class
InstiAppFirebaseMessagingService
extends
FirebaseMessagingService
{
@Override
public
void
onNewToken
(
String
s
)
{
/* For future functionality */
super
.
onNewToken
(
s
);
}
@Override
public
void
onMessageReceived
(
RemoteMessage
remoteMessage
)
{
/* For future functionality */
super
.
onMessageReceived
(
remoteMessage
);
}
}
app/src/main/java/app/insti/LoginActivity.java
View file @
c4dd53d3
...
...
@@ -20,6 +20,7 @@ import android.widget.Toast;
import
com.google.android.gms.common.ConnectionResult
;
import
com.google.android.gms.common.GoogleApiAvailability
;
import
com.google.firebase.iid.FirebaseInstanceId
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.ServiceGenerator
;
...
...
@@ -142,8 +143,19 @@ public class LoginActivity extends AppCompatActivity {
progressDialog
.
setIndeterminate
(
true
);
progressDialog
.
show
();
}
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
passwordLogin
(
username
,
password
).
enqueue
(
new
Callback
<
LoginResponse
>()
{
Call
<
LoginResponse
>
call
;
/* This can be null if play services is hung */
if
(
FirebaseInstanceId
.
getInstance
().
getToken
()
==
null
)
{
call
=
retrofitInterface
.
passwordLogin
(
username
,
password
);
}
else
{
call
=
retrofitInterface
.
passwordLogin
(
username
,
password
,
FirebaseInstanceId
.
getInstance
().
getToken
());
}
/* Log in the user */
call
.
enqueue
(
new
Callback
<
LoginResponse
>()
{
@Override
public
void
onResponse
(
Call
<
LoginResponse
>
call
,
Response
<
LoginResponse
>
response
)
{
if
(
response
.
isSuccessful
())
{
...
...
app/src/main/java/app/insti/api/RetrofitInterface.java
View file @
c4dd53d3
...
...
@@ -29,6 +29,9 @@ public interface RetrofitInterface {
@GET
(
"pass-login"
)
Call
<
LoginResponse
>
passwordLogin
(
@Query
(
"username"
)
String
username
,
@Query
(
"password"
)
String
password
);
@GET
(
"pass-login"
)
Call
<
LoginResponse
>
passwordLogin
(
@Query
(
"username"
)
String
username
,
@Query
(
"password"
)
String
password
,
@Query
(
"fcm_id"
)
String
fcmId
);
@POST
(
"events"
)
Call
<
EventCreateResponse
>
createEvent
(
@Header
(
"Cookie"
)
String
sessionId
,
@Body
EventCreateRequest
eventCreateRequest
);
...
...
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