Closed adisrini1103 closed 5 years ago
Someone proposed a pull request on my fork to address this: https://github.com/mikehardy/react-native-get-sms-android/pull/3
It is a real problem but the PR had something unrelated in it that the author hasn't addressed. I'll see if I can get it merged in cleanly and propose it here (my goal is to not have a "fork" but have everything upstream here :-) )
By the way, this only happens with pagination / batches. If you don't do batches the count will be correct
Thanks, You're right, happens only when I paginate @mikehardy
I am trying to paginate because when I try to retrieve all the messages in the inbox, and the app force closes.
I'm a bit new to native frameworks, Any other way to retrieve the complete inbox?
@adisrini1103 - nope there is no other way to handle large amounts of data other than to paginate, I think you just need to either wait for @briankabiro to merge this then use master in your project, or fork to your own area, merge the PR yourself and use master from your repo until this change is upstream. It's a super tiny change at least.
Separate way to do it (and something I've done for small patches) is to use the "patch-package" NPM module. You install it, then you manually edit a file in a module inside node_modules, and ask patch_package to make a patch for it (it responds to a --help argument, so it's easy to use). Then anytime you install that package it'll auto-apply the patch - keeping the bug fixed until there is an upstream update (hopefully fixing your bug) at which point it gives very friendly instructions.
Hope this helps
@mikehardy Yep, Trying to merge it at my end, will let you know if I run into any issues, Thank you
Hey everyone.
Was away on leave last week hence the silence. Going to have a look at it today and should be able to get it merged if everything looks good.
For every SMS retrieved, there are two empty elements in the objects, For example: when I limit to 10, I get 15 elements in the object.
5 with SMS and 2 empty
Anyone else facing this issue?
@briankabiro @mikehardy
Paging just got a fix on master, are you using the package from git master, or npmjs (and you are sure you updated?). Does this continue to happen with paging or without? (I would bet that without paging it works correctly...)
from npmjs, okay let me pull master and check it again, with paging, because I am trying to read all the messages and analyzing
Sorry guys, My bad, Pulled from the master, works great, even paging seems to work fine, did 5 paginations
Let's see if I can iterate the whole SMS book
Thank you @mikehardy
No apology needed, really happy to have a success report after that pull request since I requested the change 😁
I'm trying to analyze all the messages in the inbox, so plan to iterate in batches of 100
var filter = { box: 'inbox', body:'', indexFrom: 0, // start from index 0 maxCount: 100, // count of SMS to return each time };
Only returns "read" messages and there is only "50" objects returned. Any idea why this is happening