indywidualny / FaceSlim

Web App for Facebook. Lightweight, ad-free, chat support and modern look.
http://indywidualni.org
GNU General Public License v2.0
316 stars 63 forks source link

Message Notification #78

Closed ghost closed 8 years ago

ghost commented 8 years ago

I know you use RSS for notifications for Facebook, however is there any way to add notifications for messages too? That way I can remove Facebook Messenger.

indywidualny commented 8 years ago

No way. I just don't know how to do it. Facebook Mobile website has no message notifications in its notification feed. I'm using a feed because it's reliable and simple.

But my app is open-source. If someone could help me it would be easier to make this feature.

AlexMili commented 8 years ago

Maybe it would be possible to scrap messages URL to get all data needed. I haven't any time to develop it but if someone could try it would be great !

mcastillof commented 8 years ago

I was thinking about message notifications. Please, take a look at this C++ project https://github.com/MartinBriza/gFB (I had to install QT-Creator to compile it). That program shows you when your contacts are online and offline and messages received, among other things. We can translate it from C++ to Java, and drop the things not needed. We just need to parse the messages received and show a notification. When the user press the notification it will display FaceSlim, so the user can chat from there.

creativetrendsapps commented 8 years ago

I can help with this :+1:

ghost commented 8 years ago

Awesome news! On 1 Jan 2016 10:26 am, "Jorell Rutledge" notifications@github.com wrote:

I can help with this [image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/indywidualny/FaceSlim/issues/78#issuecomment-168268167 .

creativetrendsapps commented 8 years ago

Message notifications will work with this,

https://gist.github.com/creativetrendsapps/39ee0a94a0409b4fd21f :).

indywidualny commented 8 years ago

Awesome news! I will add this soon (next week).

sob., 2.01.2016, 08:20 Jorell Rutledge użytkownik notifications@github.com napisał:

Message notifications will work with this,

https://gist.github.com/creativetrendsapps/39ee0a94a0409b4fd21f :).

— Reply to this email directly or view it on GitHub https://github.com/indywidualny/FaceSlim/issues/78#issuecomment-168368932 .

creativetrendsapps commented 8 years ago

You can also do the same with notifications to avoid having the user getting redirected to get their RSS feed. The method used in Folio for Facebook, still grabs their RSS feed. It's based on the cookie manager though and an element from the Facebook SDK. I can share that with you as well if you'd like.

indywidualny commented 8 years ago

If you could publish a code snippet it would be great. I'm just curious. I don't want to break anything. But getting notifications directly from a Facebook notification feed seems the most reliable. I don't think I'm changing it :)

sob., 2.01.2016, 15:05 Jorell Rutledge użytkownik notifications@github.com napisał:

You can also do the same with notifications to avoid have the user getting redirected to get their RSS feed. I can share that with you as well if you'd like.

— Reply to this email directly or view it on GitHub https://github.com/indywidualny/FaceSlim/issues/78#issuecomment-168394874 .

creativetrendsapps commented 8 years ago

https://gist.github.com/creativetrendsapps/0e6303daf9dc95978b35

With this you are still getting the notifications directly from a Facebook notification. The user just doesn't need to be redirected to get their RSS feed URL. If you would like to see a working example download Folio for Facebook from the Play Store. This is how I'm getting notifications.

indywidualny commented 8 years ago

Well. Thanks a lot :) I'm changing it. Awesome job, dude. I'm gonna add you to app authors :D

sob., 2.01.2016, 16:24 Jorell Rutledge użytkownik notifications@github.com napisał:

https://gist.github.com/creativetrendsapps/0e6303daf9dc95978b35

With this you are still getting the notifications directly from a Facebook notification. The user just doesn't need to be redirected to get their RSS feed URL. If you would like to see a working example download Folio for Facebook from the Play Store. This is how I'm getting notifications.

— Reply to this email directly or view it on GitHub https://github.com/indywidualny/FaceSlim/issues/78#issuecomment-168400371 .

creativetrendsapps commented 8 years ago

You're welcome :-). You're app has helped me so, it's the least I can do :-).

indywidualny commented 8 years ago

The only thing I'm missing is com.facebook.internal.ShareConstants class. It's needed to create a feed pattern to add to base Facebook url.

Could you publish it somewhere?

creativetrendsapps commented 8 years ago

Sure. Give me a sec.

creativetrendsapps commented 8 years ago

https://github.com/creativetrendsapps/folio/blob/master/ShareConstants.java

indywidualny commented 8 years ago

Thanks. It seems to be just one constant with the value "href" so the class is not really needed. Ok, let's find out whether it is working. Everything is modified now to use your solution.

creativetrendsapps commented 8 years ago

Lets see :-).

indywidualny commented 8 years ago

https://github.com/indywidualny/FaceSlim/commit/4ec51caaeef74c426cb51fb383acb2c46d64ae46

Finally. It needs a lot of testing but should be good. Should I put your name into App Info or just a nickname is ok? :)

Or just pull request and write whatever you want. Thanks a lot again!

creativetrendsapps commented 8 years ago

Just put Creative Trends :-). I'm happy I could help!

indywidualny commented 8 years ago

Awesome. Just a quick update - notifications work! I'm not sure about message notifications, too late to write to someone but it probably works too :D

creativetrendsapps commented 8 years ago

That's great! Again, I'm happy I could help. You've made a really great app!

AlexMili commented 8 years ago

Great news ! @creativetrendsapps you rock !

creativetrendsapps commented 8 years ago

👍

pejakm commented 8 years ago

I've compiled latest code, notifications don't work at all.

indywidualny commented 8 years ago

Yes. There is a problem with mobile data. I'm guessing user agent is not set.

It uses too much data too. I'm going to restore the previous "get feed" button but make it semi-automatic now. It seems to be the best idea.

Data efficient, semi-automatic is better than the current solution. I need more time to do this so next release is delayed.

pon., 4.01.2016, 16:31 Mladen Pejaković użytkownik notifications@github.com napisał:

I've compiled latest code, notifications don't work at all.

— Reply to this email directly or view it on GitHub https://github.com/indywidualny/FaceSlim/issues/78#issuecomment-168707292 .

indywidualny commented 8 years ago

It's working now! Please test it if you want :)

I'm not sure about data usage. It may be higher. It's higher for sure. I'm not sure by how much yet. If data usage is too high I can add a preference button to auto-generate the feed before activation of notifications. It's not so convenient though.

EDIT

Oh. I've already said this before. I'm repeating myself. I need more sleep ;)

I will leave notifications activated for the whole night and I will do some math in the morning. I hope a weekly data usage for 15 minute interval will be acceptable. We can discuss it later. I don't really care how much data I'm using but this app have to be "Slim".

indywidualny commented 8 years ago

From: Tuesday, 5 January 2016, 03:35:00 To: Tuesday, 5 January 2016, 09:45:00 Result: 6 hours, 10 minutes and 0 seconds Result: 370 minutes Time interval: 15 minutes Number of checkings: floor(24.6666666667) = 24 Start: 548 KB End: 970 KB Difference: 422 KB Approx. amount of data used for one checking: 17.5833333333 KB A day has 60 * 24 = 1440 minutes It means 96 checkings per day. When you close the app the service is restarted and extra checking is performed immediately so the number is in fact bigger. 1 MB (not MiB) = 1000 KB So it uses at least 1688 KB per day (but it is always more). Ideally it's 11.816 MB per week, ~50 MB per month. But IMHO it's acceptable because at least half of the day we are on a Wi-Fi connection. Even ~100 MB of mobile data per month is still not too much. Just don't force close / swipe away the app from recents and it will be good.

Or i can just tell the checker to go to sleep when the last check was done successfully and the time interval isn't reached yet. Perfectly simple. Just sleep() the thread :)

creativetrendsapps commented 8 years ago

Just sleep the thread, lol.

indywidualny commented 8 years ago

@pejakm Are notifications working now? Please let your phone be connected to your computer to be able to copy some logs from logcat.

I'm interested in logs from the process org.indywidualni.fblite:remote

pejakm commented 8 years ago

Okay, will report back soon.

pejakm commented 8 years ago

I get message notifications, but not other notifocations.

u0_a52@p880:/ $ su
root@p880:/ # logcat | grep fblite
I/ActivityManager(  497): Start proc 2554:org.indywidualni.fblite/u0a158 for broadcast org.indywidualni.fblite/.receiver.BootCompletedIntentReceiver
I/ActivityManager(  497): Killing 2554:org.indywidualni.fblite/u0a158 (adj 15): remove task
I/ActivityManager(  497): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.indywidualni.fblite/.activity.SplashActivity bnds=[10,876][150,1080] (has extras)} from uid 10017 on display 0
V/WindowManager(  497): addAppToken: AppWindowToken{6f2d922 token=Token{2d2b86ed ActivityRecord{1ac47104 u0 org.indywidualni.fblite/.activity.SplashActivity t58}}} to stack=1 task=58 at 0
V/WindowManager(  497): Adding window Window{d9cb22b u0 Starting org.indywidualni.fblite} at 3 of 7 (after Window{2a34fd1f u0 com.cyanogenmod.trebuchet/com.android.launcher3.Launcher})
I/ActivityManager(  497): Start proc 15625:org.indywidualni.fblite/u0a158 for activity org.indywidualni.fblite/.activity.SplashActivity
V/WindowManager(  497): Adding window Window{24282334 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.SplashActivity} at 3 of 8 (before Window{d9cb22b u0 Starting org.indywidualni.fblite})
I/ActivityManager(  497): START u0 {cmp=org.indywidualni.fblite/.activity.MainActivity} from uid 10158 on display 0
V/WindowManager(  497): addAppToken: AppWindowToken{2dd0061e token=Token{14d59a59 ActivityRecord{11be3ea0 u0 org.indywidualni.fblite/.activity.MainActivity t58}}} to stack=1 task=58 at 1
V/WindowManager(  497): Adding window Window{3b3affcd u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity} at 4 of 8 (after Window{24282334 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.SplashActivity})
I/WindowState(  497): WIN DEATH: Window{3b3affcd u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity}
I/ActivityManager(  497): Process org.indywidualni.fblite (pid 15625) has died
W/ActivityManager(  497): Force removing ActivityRecord{11be3ea0 u0 org.indywidualni.fblite/.activity.MainActivity t58}: app died, no saved state
W/InstallAppProgress(19865): Replacing package:org.indywidualni.fblite
D/PackageManager(  497): Renaming /data/app/vmdl456677607.tmp to /data/app/org.indywidualni.fblite-2
I/ActivityManager(  497): Force stopping org.indywidualni.fblite appid=10158 user=-1: uninstall pkg
I/PackageManager(  497): Package org.indywidualni.fblite codePath changed from /data/app/org.indywidualni.fblite-1 to /data/app/org.indywidualni.fblite-2; Retaining data and using new
I/PackageManager(  497): Running dexopt on: /data/app/org.indywidualni.fblite-2/base.apk pkg=org.indywidualni.fblite isa=arm vmSafeMode=false
I/dex2oat ( 2236): /system/bin/dex2oat --zip-fd=6 --zip-location=/data/app/org.indywidualni.fblite-2/base.apk --oat-fd=7 --oat-location=/data/dalvik-cache/arm/data@app@org.indywidualni.fblite-2@base.apk@classes.dex --instruction-set=arm --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --no-watch-dog --swap-fd=10
W/dex2oat ( 2236): Verification of void org.indywidualni.fblite.activity.c.a() took 114.051ms
I/ActivityManager(  497): Force stopping org.indywidualni.fblite appid=10158 user=-1: update pkg
W/PackageManager(  497): Code path for pkg : org.indywidualni.fblite changing from /data/app/org.indywidualni.fblite-1 to /data/app/org.indywidualni.fblite-2
W/PackageManager(  497): Resource path for pkg : org.indywidualni.fblite changing from /data/app/org.indywidualni.fblite-1 to /data/app/org.indywidualni.fblite-2
I/ActivityManager(  497): Force stopping org.indywidualni.fblite appid=10158 user=0: pkg removed
D/BackupManagerService(  497): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:org.indywidualni.fblite flg=0x4000010 (has extras) }
D/BackupManagerService(  497): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:org.indywidualni.fblite flg=0x4000010 (has extras) }
W/BackupManagerService(  497): Removing schedule queue dupe of org.indywidualni.fblite
D/NlpPackageReceiver( 2050): Intent received: Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:org.indywidualni.fblite flg=0x4000010 cmp=com.google.android.gms/org.microg.nlp.PackageReceiver (has extras) }
D/NlpPackageReceiver( 2050): Intent received: Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:org.indywidualni.fblite flg=0x4000010 cmp=com.google.android.gms/org.microg.nlp.PackageReceiver (has extras) }
I/ActivityManager(  497): Start proc 2339:org.indywidualni.fblite/u0a158 for broadcast org.indywidualni.fblite/.receiver.PackageReplacedIntentReceiver
I/Timeline(19865): Timeline: Activity_launch_request id:org.indywidualni.fblite time:5542883
I/ActivityManager(  497): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.indywidualni.fblite cmp=org.indywidualni.fblite/.activity.SplashActivity} from uid 10041 on display 0
V/WindowManager(  497): addAppToken: AppWindowToken{6f0a0dd token=Token{12c6fcb4 ActivityRecord{5069587 u0 org.indywidualni.fblite/.activity.SplashActivity t77}}} to stack=1 task=77 at 0
V/WindowManager(  497): Adding window Window{2dd1cbaa u0 Starting org.indywidualni.fblite} at 5 of 9 (after Window{237dce30 u0 com.android.packageinstaller/com.android.packageinstaller.InstallAppProgress})
V/WindowManager(  497): Adding window Window{2b80e150 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.SplashActivity} at 5 of 10 (before Window{2dd1cbaa u0 Starting org.indywidualni.fblite})
I/Timeline( 2339): Timeline: Activity_launch_request id:org.indywidualni.fblite time:5543257
I/ActivityManager(  497): START u0 {cmp=org.indywidualni.fblite/.activity.MainActivity} from uid 10158 on display 0
V/WindowManager(  497): addAppToken: AppWindowToken{12aa356f token=Token{27e2a04e ActivityRecord{1e667f49 u0 org.indywidualni.fblite/.activity.MainActivity t77}}} to stack=1 task=77 at 1
V/WindowManager(  497): Adding window Window{2dd1cbaa u0 Starting org.indywidualni.fblite} at 6 of 10 (after Window{2b80e150 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.SplashActivity})
V/WindowManager(  497): Adding window Window{2b773e80 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity} at 6 of 11 (before Window{2dd1cbaa u0 Starting org.indywidualni.fblite})
I/ActivityManager(  497): Displayed org.indywidualni.fblite/.activity.MainActivity: +1s241ms (total +1s650ms)
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{1e667f49 u0 org.indywidualni.fblite/.activity.MainActivity t77} time:5544597
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
I/Timeline( 2339): Timeline: Activity_launch_request id:org.indywidualni.fblite time:5552352
I/ActivityManager(  497): START u0 {cmp=org.indywidualni.fblite/.activity.SettingsActivity} from uid 10158 on display 0
V/WindowManager(  497): addAppToken: AppWindowToken{f6887f8 token=Token{17bdf35b ActivityRecord{2f90326a u0 org.indywidualni.fblite/.activity.SettingsActivity t77}}} to stack=1 task=77 at 1
V/WindowManager(  497): Adding window Window{2770b36 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.SettingsActivity} at 5 of 9 (after Window{2b773e80 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity})
I/ActivityManager(  497): Displayed org.indywidualni.fblite/.activity.SettingsActivity: +705ms
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{2f90326a u0 org.indywidualni.fblite/.activity.SettingsActivity t77} time:5553321
I/ActivityManager(  497): Start proc 2602:org.indywidualni.fblite:remote/u0a158 for service org.indywidualni.fblite/.service.NotificationsService
V/WindowManager(  497): not Base app: Adding window Window{25ca692f u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.SettingsActivity} at 6 of 10
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{1e667f49 u0 org.indywidualni.fblite/.activity.MainActivity t77} time:5563649
V/WindowManager(  497): Adding window Window{25ffb6c u0 PopupWindow:4a91aef} at 5 of 9 (after Window{2b773e80 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity})
V/WindowManager(  497): Adding window Window{3cd12dca u0 PopupWindow:4a91aef} at 5 of 9 (after Window{2b773e80 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity})
V/WindowManager(  497): Adding window Window{29076258 u0 PopupWindow:4a91aef} at 5 of 9 (after Window{2b773e80 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity})
I/WindowState(  497): WIN DEATH: Window{2b773e80 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity}
I/ActivityManager(  497): Process org.indywidualni.fblite (pid 2339) has died
W/ActivityManager(  497): Force removing ActivityRecord{1e667f49 u0 org.indywidualni.fblite/.activity.MainActivity t77}: app died, no saved state
I/ActivityManager(  497): Start proc 3989:org.indywidualni.fblite/u0a158 for content provider org.indywidualni.fblite/net.grandcentrix.tray.provider.TrayProvider
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
I/ActivityManager(  497): Killing 3989:org.indywidualni.fblite/u0a158 (adj 11): remove task
I/ActivityManager(  497): Killing 2602:org.indywidualni.fblite:remote/u0a158 (adj 5): remove task
W/ActivityManager(  497): Scheduling restart of crashed service org.indywidualni.fblite/.service.NotificationsService in 1000ms
I/ActivityManager(  497): Start proc 4080:org.indywidualni.fblite:remote/u0a158 for service org.indywidualni.fblite/.service.NotificationsService
I/ActivityManager(  497): Start proc 4097:org.indywidualni.fblite/u0a158 for content provider org.indywidualni.fblite/net.grandcentrix.tray.provider.TrayProvider
D/StatusBar(  622): Clicked on content of 0|org.indywidualni.fblite|1|null|10158
I/ActivityManager(  497): START u0 {act=NOTIFICATION_URL_ACTION cmp=org.indywidualni.fblite/.activity.MainActivity (has extras)} from uid 10158 on display 0
W/ActivityManager(  497): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=NOTIFICATION_URL_ACTION cmp=org.indywidualni.fblite/.activity.MainActivity (has extras) }
V/WindowManager(  497): addAppToken: AppWindowToken{3b9c3d7f token=Token{30567e9e ActivityRecord{1900a4d9 u0 org.indywidualni.fblite/.activity.MainActivity t79}}} to stack=1 task=79 at 0
V/WindowManager(  497): Adding window Window{1d765d77 u0 Starting org.indywidualni.fblite} at 3 of 7 (after Window{2a34fd1f u0 com.cyanogenmod.trebuchet/com.android.launcher3.Launcher})
W/art     ( 4097): Verification of void org.indywidualni.fblite.activity.MainActivity.a(int, java.lang.String) took 129.890ms
V/WindowManager(  497): Adding window Window{111318bd u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity} at 3 of 8 (before Window{1d765d77 u0 Starting org.indywidualni.fblite})
I/ActivityManager(  497): Displayed org.indywidualni.fblite/.activity.MainActivity: +845ms
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{1900a4d9 u0 org.indywidualni.fblite/.activity.MainActivity t79} time:5910592
I/WindowState(  497): WIN DEATH: Window{111318bd u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity}
I/ActivityManager(  497): Process org.indywidualni.fblite (pid 4097) has died
W/ActivityManager(  497): Force removing ActivityRecord{1900a4d9 u0 org.indywidualni.fblite/.activity.MainActivity t79}: app died, no saved state
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
I/ActivityManager(  497): START u0 {act=NOTIFICATION_URL_ACTION flg=0x10100000 cmp=org.indywidualni.fblite/.activity.MainActivity (has extras)} from uid 10158 on display 0
V/WindowManager(  497): addAppToken: AppWindowToken{dafb99d token=Token{aa40074 ActivityRecord{276a5047 u0 org.indywidualni.fblite/.activity.MainActivity t79}}} to stack=1 task=79 at 0
V/WindowManager(  497): Adding window Window{38caea0c u0 Starting org.indywidualni.fblite} at 3 of 7 (after Window{2a34fd1f u0 com.cyanogenmod.trebuchet/com.android.launcher3.Launcher})
I/ActivityManager(  497): Start proc 6307:org.indywidualni.fblite/u0a158 for activity org.indywidualni.fblite/.activity.MainActivity
V/WindowManager(  497): Adding window Window{2a37e51a u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity} at 3 of 8 (before Window{38caea0c u0 Starting org.indywidualni.fblite})
I/ActivityManager(  497): Displayed org.indywidualni.fblite/.activity.MainActivity: +733ms
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{276a5047 u0 org.indywidualni.fblite/.activity.MainActivity t79} time:5958597
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
I/ActivityManager(  497): Killing 6307:org.indywidualni.fblite/u0a158 (adj 9): remove task
I/WindowState(  497): WIN DEATH: Window{2a37e51a u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity}
I/ActivityManager(  497): Killing 4080:org.indywidualni.fblite:remote/u0a158 (adj 5): remove task
W/ActivityManager(  497): Scheduling restart of crashed service org.indywidualni.fblite/.service.NotificationsService in 20861ms
I/ActivityManager(  497): Start proc 6477:org.indywidualni.fblite:remote/u0a158 for service org.indywidualni.fblite/.service.NotificationsService
I/ActivityManager(  497): Start proc 6494:org.indywidualni.fblite/u0a158 for content provider org.indywidualni.fblite/net.grandcentrix.tray.provider.TrayProvider
D/StatusBar(  622): Clicked on content of 0|org.indywidualni.fblite|1|null|10158
I/ActivityManager(  497): START u0 {act=NOTIFICATION_URL_ACTION cmp=org.indywidualni.fblite/.activity.MainActivity (has extras)} from uid 10158 on display 0
W/ActivityManager(  497): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=NOTIFICATION_URL_ACTION cmp=org.indywidualni.fblite/.activity.MainActivity (has extras) }
V/WindowManager(  497): addAppToken: AppWindowToken{19ad378b token=Token{3d3e295a ActivityRecord{3fd9505 u0 org.indywidualni.fblite/.activity.MainActivity t80}}} to stack=1 task=80 at 0
V/WindowManager(  497): Adding window Window{10d889b2 u0 Starting org.indywidualni.fblite} at 3 of 7 (after Window{2a34fd1f u0 com.cyanogenmod.trebuchet/com.android.launcher3.Launcher})
V/WindowManager(  497): Adding window Window{20a13cf3 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity} at 3 of 8 (before Window{10d889b2 u0 Starting org.indywidualni.fblite})
I/ActivityManager(  497): Displayed org.indywidualni.fblite/.activity.MainActivity: +769ms
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{3fd9505 u0 org.indywidualni.fblite/.activity.MainActivity t80} time:9637854
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
V/WindowManager(  497): Adding window Window{b56b1a4 u0 Starting com.viber.voip} at 4 of 8 (after Window{20a13cf3 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity})
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
I/Timeline(  497): Timeline: Activity_windows_visible id: ActivityRecord{3fd9505 u0 org.indywidualni.fblite/.activity.MainActivity t80} time:9705828
I/WindowState(  497): WIN DEATH: Window{20a13cf3 u0 org.indywidualni.fblite/org.indywidualni.fblite.activity.MainActivity}
I/ActivityManager(  497): Process org.indywidualni.fblite (pid 6494) has died
W/ActivityManager(  497): Force removing ActivityRecord{3fd9505 u0 org.indywidualni.fblite/.activity.MainActivity t80}: app died, no saved state
W/PackageManager(  622): Failure retrieving resources for org.indywidualni.fblite: Resource ID #0x0
I/ActivityManager(  497): Start proc 8983:org.indywidualni.fblite/u0a158 for content provider org.indywidualni.fblite/net.grandcentrix.tray.provider.TrayProvider
^C
130|root@p880:/ # logcat | grep fblite:remote
I/ActivityManager(  497): Start proc 2602:org.indywidualni.fblite:remote/u0a158 for service org.indywidualni.fblite/.service.NotificationsService
I/ActivityManager(  497): Killing 2602:org.indywidualni.fblite:remote/u0a158 (adj 5): remove task
I/ActivityManager(  497): Start proc 4080:org.indywidualni.fblite:remote/u0a158 for service org.indywidualni.fblite/.service.NotificationsService
I/ActivityManager(  497): Killing 4080:org.indywidualni.fblite:remote/u0a158 (adj 5): remove task
I/ActivityManager(  497): Start proc 6477:org.indywidualni.fblite:remote/u0a158 for service org.indywidualni.fblite/.service.NotificationsService
^C
130|root@p880:/ #
indywidualny commented 8 years ago

Well. I don't know why but there are no my logs. Just system logs :D

ghost commented 8 years ago

I compiled the app yesterday, and get notifications for both messages and normal. On 7 Jan 2016 7:08 am, "Krzysztof Grabowski" notifications@github.com wrote:

Well. I don't know why but there are no my logs. Just system logs :D

— Reply to this email directly or view it on GitHub https://github.com/indywidualny/FaceSlim/issues/78#issuecomment-169461480 .

indywidualny commented 8 years ago

@pejakm thanks for the crash report. Sorry about crash :) Now I know everything. It's close to be finally resolved.

pejakm commented 8 years ago

Still no Facebook notifications, sorry. :(

indywidualny commented 8 years ago

@pejakm don't worry. I will add a log saver soon to finally locate your issue.

indywidualny commented 8 years ago

Please test notifications with file logging enabled. Logs are saved to [sdcard]/FaceSlim.log Please attach the file here (somehow). Maybe it will tell us more about notifications problems.

https://github.com/indywidualny/FaceSlim/blob/79066166bdea2844d2bd57b020325c547d28c0f5/app/app-release.apk

pejakm commented 8 years ago
2016-01-10 09:38:47.762 NotificationsService: Time interval: 900 seconds
2016-01-10 09:38:47.842 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-10 09:38:47.879 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 09:38:47.924 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-10 09:38:47.941 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-10 09:38:49.376 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-10 09:38:50.037 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 09:38:50.738 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-10 09:38:50.751 RssReaderTask: doInBackground: URL error
2016-01-10 09:38:50.763 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 09:38:51.811 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 09:38:52.084 RssReaderTask: doInBackground: Processing... Trial: 2
2016-01-10 09:38:52.125 RssReaderTask: doInBackground: URL error
2016-01-10 09:38:52.257 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 09:38:53.470 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 09:38:53.687 RssReaderTask: doInBackground: Processing... Trial: 3
2016-01-10 09:38:53.718 RssReaderTask: doInBackground: URL error
2016-01-10 09:38:53.764 RssReaderTask: onPostExecute: Failure
2016-01-10 09:53:48.009 NotificationsService: Time interval: 900 seconds
2016-01-10 09:53:48.056 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-10 09:53:48.080 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 09:53:48.138 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-10 09:53:48.167 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-10 09:53:49.530 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-10 09:53:51.930 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 09:53:52.843 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-10 09:53:52.862 RssReaderTask: doInBackground: URL error
2016-01-10 09:53:52.882 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 09:53:53.716 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 09:53:53.987 RssReaderTask: doInBackground: Processing... Trial: 2
2016-01-10 09:53:54.005 RssReaderTask: doInBackground: URL error
2016-01-10 09:53:54.014 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 09:53:54.678 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 09:53:54.822 RssReaderTask: doInBackground: Processing... Trial: 3
2016-01-10 09:53:54.830 RssReaderTask: doInBackground: URL error
2016-01-10 09:53:54.850 RssReaderTask: onPostExecute: Failure
2016-01-10 10:08:48.259 NotificationsService: Time interval: 900 seconds
2016-01-10 10:08:48.349 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-10 10:08:48.389 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 10:08:48.404 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-10 10:08:48.424 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-10 10:08:49.511 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 10:08:49.517 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-10 10:08:49.999 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-10 10:08:50.013 RssReaderTask: doInBackground: URL error
2016-01-10 10:08:50.027 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 10:08:50.871 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 10:08:51.014 RssReaderTask: doInBackground: Processing... Trial: 2
2016-01-10 10:08:51.025 RssReaderTask: doInBackground: URL error
2016-01-10 10:08:51.033 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 10:08:51.785 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 10:08:51.929 RssReaderTask: doInBackground: Processing... Trial: 3
2016-01-10 10:08:51.941 RssReaderTask: doInBackground: URL error
2016-01-10 10:08:51.959 RssReaderTask: onPostExecute: Failure
2016-01-10 10:09:25.304 NotificationsService: ********** Service created! **********
2016-01-10 10:09:28.654 NotificationsService: Time interval: 900 seconds
2016-01-10 10:09:28.763 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-10 10:09:28.825 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 10:09:28.854 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-10 10:09:28.883 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-10 10:09:30.805 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-10 10:09:30.879 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 10:09:31.589 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-10 10:09:31.610 RssReaderTask: doInBackground: URL error
2016-01-10 10:09:31.626 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 10:09:32.522 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 10:09:32.766 RssReaderTask: doInBackground: Processing... Trial: 2
2016-01-10 10:09:32.782 RssReaderTask: doInBackground: URL error
2016-01-10 10:09:32.800 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 10:09:33.535 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-10 10:09:33.889 RssReaderTask: doInBackground: Processing... Trial: 3
2016-01-10 10:09:33.909 RssReaderTask: doInBackground: URL error
2016-01-10 10:09:33.935 RssReaderTask: onPostExecute: Failure
pejakm commented 8 years ago

I can access https://web.facebook.com/notifications in my browser just fine.

pejakm commented 8 years ago

I've also tried using "https://m.facebook.com/notifications" for the NOTIFICATIONS_URL at https://github.com/indywidualny/FaceSlim/blob/master/app/src/main/java/org/indywidualni/fblite/service/NotificationsService.java#L47, but still no luck, same error.

indywidualny commented 8 years ago

Well. Both urls don't work. It's so strange. I will add user agent logging because user agent seems to be the problem here. At least one url should work, depending on your connection type.

At least now we know what is exactly the problem - feed url cannot be generated.

@creativetrendsapps what notifications url are you using in your app?

Has someone any ideas?

My logs:

2016-01-10 15:34:20.233 NotificationsService: ********** Service created! **********
2016-01-10 15:34:23.292 NotificationsService: Time interval: 900 seconds
2016-01-10 15:34:23.339 NotificationsService: I'm going to wait. Resuming in: 514 seconds
2016-01-10 15:47:00.933 NotificationsService: Lock is now released
2016-01-10 15:47:01.006 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-10 15:47:01.056 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-10 15:47:01.091 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-10 15:47:01.121 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-10 15:47:02.273 NotificationsService: Start notification. isMessage: true
2016-01-10 15:47:02.357 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-10 15:47:02.451 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-10 15:47:03.205 RssReaderTask: onPostExecute: Aight biatch ;)
pejakm commented 8 years ago

I've changed user agent to match my phone browser's (Lightning Browser). Still the same error. Anything else I can do to find out why "URL error" is happening?

indywidualny commented 8 years ago

I have no idea. But I'm thinking all the time. I will try to use the webview's user agent, because it's where we are logged in to Facebook. It may fix it.

Every MainActivity start this string will be saved to preferences (WebView can be upgraded). The service will get it during every checking task.

It's better than creating a new (pretty big) WebView object inside the service - this way it will still use only ~3 - 11 MB od RAM.

indywidualny commented 8 years ago

@pejakm Try this. With logging enabled. https://github.com/indywidualny/FaceSlim/blob/4823a684cf8e156851088f0cc85a0aa59bbf35cc/app/app-release.apk [updated: Log connection type]

If you are using Google Chrome (mobile) you can check these addresses: view-source:https://www.facebook.com/notifications view-source:https://web.facebook.com/notifications

When something is wrong you cannot find an element "RSS Feed". At least one URL should work.

pejakm commented 8 years ago
2016-01-11 14:29:28.590 NotificationsService: ********** Service created! **********
2016-01-11 14:29:31.979 NotificationsService: Time interval: 300 seconds
2016-01-11 14:29:32.113 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-11 14:29:32.133 NotificationsService: Connection Type: Wi-Fi
2016-01-11 14:29:32.176 NotificationsService: User Agent: Mozilla/5.0 (Linux; Android 5.1.1; Build/LYZ28N) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36
2016-01-11 14:29:32.258 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-11 14:29:32.279 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-11 14:29:32.404 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-11 14:29:34.041 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-11 14:29:34.236 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-11 14:29:35.001 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-11 14:29:35.035 RssReaderTask: doInBackground: URL error
2016-01-11 14:29:35.069 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-11 14:29:36.929 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-11 14:29:37.156 RssReaderTask: doInBackground: Processing... Trial: 2
2016-01-11 14:29:37.200 RssReaderTask: doInBackground: URL error
2016-01-11 14:29:37.229 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-11 14:29:38.643 RssReaderTask:getFeed: Trying: https://web.facebook.com/notifications
2016-01-11 14:29:39.200 RssReaderTask: doInBackground: Processing... Trial: 3
2016-01-11 14:29:39.235 RssReaderTask: doInBackground: URL error
2016-01-11 14:29:39.290 RssReaderTask: onPostExecute: Failure
pejakm commented 8 years ago

I've checked the source, there's no "RSS Feed" line anywhere. There's only "РСС" ("RSS" written in Cyrillic script). I'm using Facebook in Serbian, could this be the cause?

pejakm commented 8 years ago
  2016-01-11 15:04:57.671 NotificationsService: ********** Service created! **********
2016-01-11 15:05:00.838 NotificationsService: Time interval: 300 seconds
2016-01-11 15:05:00.926 NotificationsService: Internet connection active. Starting AsyncTasks...
2016-01-11 15:05:00.943 NotificationsService: Connection Type: Wi-Fi
2016-01-11 15:05:00.970 NotificationsService: User Agent: Mozilla/5.0 (Linux; Android 5.1.1; Build/LYZ28N) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36
2016-01-11 15:05:01.019 RssReaderTask:getFeed: Trying: https://www.facebook.com/notifications
2016-01-11 15:05:01.033 CheckMessagesTask: doInBackground: Processing... Trial: 1
2016-01-11 15:05:01.055 CheckMsgTask:getNumber: Trying: https://m.facebook.com/messages
2016-01-11 15:05:02.696 CheckMessagesTask: onPostExecute: Aight biatch ;)
2016-01-11 15:05:02.752 RssReaderTask: doInBackground: Processing... Trial: 1
2016-01-11 15:05:03.997 NotificationsService: Start notification - isMessage: false
2016-01-11 15:05:04.270 RssReaderTask: onPostExecute: Aight biatch ;)

Yes, I was right! I switched my Facebook to US English, and immediatelly I got a notification. :)

indywidualny commented 8 years ago

Awesome! Here is my solution. I will buy some beers and spend the night switching languages and checking "RSS" word in different languages. Next I will create an enum with all the records and their locales.

The app will get the right word basing on device locale. The only problem occurs when someone is using Facebook in a different language than a language of his device.

Has someone a better idea?

pejakm commented 8 years ago

Has someone a better idea?

You need to find what? The link? Just the word? This is a relevant part of the code, right? <a href="/feeds/notifications.php?id=1295895653&amp;viewer=blaah&amp;key=blahblah&amp;format=rss20">РСС</a> for Serbian and <a href="/feeds/notifications.php?id=1295895653&amp;viewer=blaah&amp;key=blahblah&amp;format=rss20">RSS</a> for English? Can you match something other than the plain text "RSS"?

pejakm commented 8 years ago

I will test the following change at this line:

add a[href]:matches(rss20) instead of a:matches(RSS)

Edit: Nope, failed. Edit 2: Solution was, actually, quite easy.