-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening relevant app on notification click #10
Comments
Hello. <intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.com.nextcloud.talk2.chat" />
</intent-filter> As it can be seen from this snippet Nextcloud Talk expects intent with specific mime-type which would porbably(have not checked it yet) will open right app.
Such an implementation would be generic enough and so we can definetely implement processors for opening url and opening app now and then in future implement app-specific processors. Also I am not sure whether we really need those priorities, but it definetely safer having them :) |
Hello, I've been trying several different settings to get notifications from Nextcloud Talk and then saw this conversation. I'm not very knowledgable in this area, so is this saying that notifications from Talk can't open in the Talk app just yet? |
Hello @Gene-W. Yes opening app relevant to notification(e.g. Talk on spreed notifications) is not yet implemented. Currently app only opens web version of relevant app. In future I am going to implement this feature |
Excellent, thank you for clarifying. And thank you for your work on this project! |
I hate to be that annoying user who bothers foss devs with pings of "any progress?" but since deck app dev seems reluctant to implement built-in notifications for his app and since I dont have the skills to understand what this means I'm not sure what else to do other then ask if there has been any updates to this feature. This is a pretty important feature for the deck app. Right now If I get a notification from deck that I need to reach out to alice, I cant do anything with it, because I cant click on the notification to open the deck app and see that its a reminder to talk with her about bob. |
@ahcheing Hello. Unfortunately I can not implement this solely by myself. It is possible for me to tell for example Deck that something happend(e.g. notification), though from other side @stefan-niedermann would need to write a code handling the notifications from my app |
Hello @Andrewerr, I'm wrapping my head around implementing a feature that opens the relevant app on notification click, and I'd like to know your opinion.
The simplest way would be to use the url in the notification as intent (like when you visit a
youtube.com/something
url and your device opens YouTube app), but this cannot work with Nextcloud, as every instance has a different base url.So I completed a very basic implementation that opens the relevant app using its package name (see penguin86@9214895 ).
This work for all the applications for which the app knows the package name (there is an app->package name mapping in
nextcloud_package_names.xml
and every new app developed needs to be added there). If the app is not installed, the notification link will be opened in browser.This is fine to me, but I didn't issue a pull request because this isn't a complete solution: it works fine opening the corresponding app, but it opens the default activity or, if the app is running, brings on top the currently open activity. I.e., for Talk, you may click on a notification by John and see the Jack's chat, because it was the last you interacted with.
Now I'm trying to open the right activity, but this is definitely more challenging. There isn't a generic solution working for all apps.
I.e., Talk receives a GCM (now FCM) push message, retrieves the notification from notification API (as we do) and generates its own activity-opening intent. We could mock the message GCM sends to Talk and call it a day, but this wouldn't work with the F-Droid flavor, as the GCM code is present only on the Gplay flavor.
A solution could be bringing into NextcloudServices the entire notification parsing and intent generation code from Talk ( https://github.com/nextcloud/talk-android/blob/master/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java etc...), but I think this is bad for a couple of reasons:
Any ideas on how this could be implemented cleaner?
Anyway, what do you think? Should we implement a per-app solution or is it sufficient to genericly open the right app, at least for now?
The text was updated successfully, but these errors were encountered: