• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Firebase Cloud Functions - Detect Changes to List inside Document

I have tried searching around to find how to best do this in Firestore (I am new to nosql/non relational databases). I recently discovered Cloud Functions as a way to send notifications to users of my app when changes have been made to a document in the database. That part is very clear, however I am not able to see the best way to do this for lists that are stored inside that document. Currently my structure has an Image document that was added to the Uploads collection. Each Image has it's own document ID of course. I am trying to send a notification when a new like has been added. My Cloud Function below is attempting to grab the old like list and compare it to the new like list to determine the new value (Or if any changes made at all).

JavaScript:
exports.sendNewLikeNotification = functions.firestore
    .document('Uploads/{image_id}')
    .onUpdate(event => {
        const oldValue = event.before.data();
        const newValue = event.after.data();

        const oldLikes = oldValue.likes
        const newLikes = newValue.likes

/* Code that will comp[are like values */
    });

Am I headed in the right direction with this, or is there a better way of doing this? Will this path even work?

How To Automate Opening Of App?

Hi, I have a question about about automating a task on my Amazon Fire Stick 4k.

To explain, I have rooted my Amazon Fire Stick 4k and replaced the launcher and I'm trying to figure out if there is a way to create a sequence of events (maybe it's called a tasker?) where I would like to either a) create some kind of shortcut on the desktop that when you click it, it will first open my VPN (VPN Client Pro) and connect to my VPN and then open my Comcast Xfinity Stream app or b) When I click on the Comcast Xfinity Stream app on the desktop, it first opens my VPN Client Pro (connects to my VPN), and then opens Xfinity Stream.

I'm not sure how to go about this, so any help is once again greatly appreciated!

phone erases itself!!

"Hacked" is probably the least likely explanation (it's a conclusion people often jump to when they see something they don't understand, but usually there's a more prosaic explanation).
.....
A statement that needs to be emphasized. Once you just assume the problem is due to '...being hacked' than you'll never find out just what was the actual cause. Odds are when your data was spontaneously wiped in the middle of the night, it was because of some seriously bad software glitch.
Theoretically, if some mythical 'hacker' did manage to compromise your phone, he/she would be doing so to do some kind of data mining on you. Deleting your data would be just an act of pure malice, the issue being there's the TV/movie version of a hacker, and then there's reality. Also remotely accessing your phone in this situation would be daunting task, something that requires an advanced skill set, and they're targeting you specifically for whatever reasons. (... unless you live with someone with easy physical contact to your phone, and who is really pissed at you, which would be more of a family politics matter.)

Anyway, this isn't a common problem and determining just what happened isn't going to solved on an online help forum. All any of us can do is speculate and guess. This is more of a hands-on issue to determine just what happened, someone at a trained, technical skill-level to do a basic forensics examination.

On a side-note, do you have backups of your data? Hopefully yes so you lost a minimum of important stuff.

Open a API link in web browser (API + WebView + Link)

Description:

I have a link that cames in API and I use webview aplication to open this.

And this API send me a link like that:

<a href="##" onclick="window.open('#qSetupURL.VALOR##arquivocodigo#?#qSetupToken.VALOR#', '_system'); return false;" title="#arquivorecebido#" data-toggle="tooltip">#arquivorecebido#</a>

But in the mobile this link can't be opened and I need to open this in a web browser.

I am new in Java development and need help :(

Help Unable to boot, transfer files using TWRP recovery

Hi everyone, I wanted to update the thread here. I was able to buy a new battery and an original charger for phone and as soon as I replaced it, the phone automatically was reverted back to it's Stock CYANOGEN rom. It's working perfectly again. Thank you for all of your support @tommo47 @svim @Hadron @ocnbrze @MrJavi

The advice was really accurate!!

Help Optomizing app 1 of 1 MY SOLUTION

My RCA Venturer Saturn 10" pro began giving this fault," Optomizing app 1 of 1" every time I went to switch the thing on. I googled solutions like deleting the last programme installed or clearing the cache etc to no avail. I then did a factory reset but DID NOT include a four digit code. One of the google programmes tried to force me to include one (the document writer I think) but I refused and found one which didnt go online to access files instead. Since I did this the Optomizing app 1 of 1 has NEVER reoccoured plus I can install whatever programme I like and there is no faults happening.

Android GraphView show double

which line is Y-axis?
private void startTimer() {
handler = new Handler();
handler.postDelayed(timer = new Runnable() {
@override
public void run() {
Cursor cursor = databaseHelper.GetLastParameters();
cursor.moveToLast();
try {
xLastVlue++;
Double Voltage = cursor.getDouble( cursor.getColumnIndex("Voltage") );
Double Current = cursor.getDouble(cursor.getColumnIndex("FlowCurrent"));
series.appendData(new DataPoint(xLastVlue, Voltage * 10d), true, 40);
series2.appendData(new DataPoint(xLastVlue, Current * 10d), true, 40);

} catch (Exception e) {
e.printStackTrace();
}

handler.postDelayed(this, Delay_Timer);



}
}, Delay_Timer);
}

Littering is my pet peeve!

There has been so much trash in my neighborhood lately. I bought a trash picker upper claw like an old man and am now cleaning up my block a few times a week. Someone suggested I download this app so I'm giving it a try!

It's rather cumbersome to take a photo of each piece of trash you pick up but I'm curious to see if this project goes anywhere. Has anyone else downloaded this?


I hate trash along the roads and in yards. I mow commercially and have to clean up each yard before I mow so I don't shred the trash all over the lawns. It's a big pain. I have no idea the line of thought that makes anyone feel it's a grand idea to just toss trash to the wind!

Help Error 101

What phone do you have, did you or someone else flash non-stock firmware to it? This error is a security protocol from T-Mobile if it detects the firmware has been modified. The fix would presumably be to flash it back to stock if this is the case. However the only references I can find to this error are several years old and the link to the securelock site is no longer valid.

Filter

Back
Top Bottom