Skip to content

Added a dummy notification functionality#21

Open
ajaynair wants to merge 5 commits intomasterfrom
AppNotification
Open

Added a dummy notification functionality#21
ajaynair wants to merge 5 commits intomasterfrom
AppNotification

Conversation

@ajaynair
Copy link
Copy Markdown
Contributor

Capture

Capture2

@ajaynair ajaynair requested a review from dotbugfix March 17, 2019 18:58
@ajaynair ajaynair self-assigned this Mar 17, 2019
@ajaynair
Copy link
Copy Markdown
Contributor Author

Capture3

@ajaynair
Copy link
Copy Markdown
Contributor Author

Clicking on 'SendNotification' button creates a notification.
Clicking on the notification takes user back to WittyApp (to an activity with a textbox 'New Upcoming Event')

@dotbugfix
Copy link
Copy Markdown
Member

Crashed on my phone on clicking the 'sendnotification' button:

2019-03-19 11:06:13.240 26263-26263/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.saraswitty.wittyapp, PID: 26263
    java.lang.IllegalStateException: Could not find method sendNotification(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'button2'
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:424)
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:381)
        at android.view.View.performClick(View.java:6259)
        at android.view.View$PerformClick.run(View.java:24732)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6592)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
2019-03-19 11:06:13.245 1929-2709/? W/ActivityManager:   Force finishing activity com.saraswitty.wittyapp/.AuthenticatedActivity
2019-03-19 11:06:13.251 1929-1970/? I/ActivityManager: Showing crash dialog for package com.saraswitty.wittyapp u0

@dotbugfix
Copy link
Copy Markdown
Member

I can now see the notification, but when I tap on it (and the 'New Upcoming Event' page comes up), the notification itself doesn't go away. It still stays in the notification bar and I can tap it any number of times to go to the app.
Maybe we need some logic to dismiss the notification after it is tapped?

@dotbugfix
Copy link
Copy Markdown
Member

We need to look into session management for the app. After tapping the 'Log in with Facebook' button, the 'AuthenticatedActivity' shows up, with the 'sendnotification' button. Now I can tap the 'back' button (Android action), so we are back at the login page. Now, if there is a notification in the panel for WittyApp and I tap it, it will still open the 'New Upcoming Event' page.

This should not happen. If the user logs out or is not authenticated, then no other pages of the app should be visible from any entry point. In any case, we will probably need to store the FB auth token (or some other unique identifier for the user) such that it is accessible globally to all activities/services in the app. We will need to use it for DB queries and/or REST APIs.

@dotbugfix
Copy link
Copy Markdown
Member

Seen in logcat:

I/Choreographer: Skipped 43 frames!  The application may be doing too much work on its main thread.

We should do the FB login in a background async thread!

Changed App notification icon
Changed App launcher icon
@ajaynair
Copy link
Copy Markdown
Contributor Author

n1

n2

n3

n4

.setSmallIcon(R.drawable.sneh_small_icon)
.setChannelId(channelID)
.setContentIntent(pendingIntent)
.addAction(R.drawable.sneh_small_icon, "Sign Me Up",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip the small icon on the action buttons? Just the text 'Sign me up' should be good enough.

snoozePendingIntent)
.setAutoCancel(true)
.setStyle(NotificationCompat.BigPictureStyle()
.bigPicture(BitmapFactory.decodeResource(resources, R.drawable.sneh_large_icon))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the image/photo seen in the notification or the app icon on the left?

@dotbugfix
Copy link
Copy Markdown
Member

In the image below, did you try using the full logo? Does it not look good in the notification bar?

n3

@dotbugfix
Copy link
Copy Markdown
Member

In the image below, why is there a grey icon at the bottom right corner of the Sneh icon? It looks weird.

n4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants