Update database on server when app is being uninstalled - java

I know there might be many questions like my question. But It is different. Actually, I am making a static chart that will show how many devices currently having my Android app installed and how many devices have uninstalled it.
For this, I am creating a uniqueID when the app is installed on a device and saving uniqueID along with FCM token to SQL database on the server.
To Create uniqueID:
uniqueID = UUID.randomUUID().toString()
Now, while I am saving every device with a token and uniqueID to the database. Of course, the device will be considered to have active app installation even when uninstalled the app.
So, I want to add a field in the database as inactive against the device that has uninstalled the app. To achieve this, I am thinking to send a request to the database and update the information when the app uninstallation is triggered.
Is this possible? And if yes, then can anyone please tell me how. Or are there any other method to achieve this. Thanks in advance.

Yes it it possible. You can send a push notification to your app to all your active users everyday from your backend side, and on your Android side, call an API on your server to confirm that you exist. If a client does not confirm his existence in a period of time (like 3 days), you know they have uninstalled the app. This is what Adjust and other statistics do for uninstall statistics.

You can't easily run your own code when an app is uninstalled. It is possible to run code in another app, but that requires that you get the user to install both apps.
In addition to the approach Adib described, you can consider using Google Analytics for Firebase to detect uninstalls of your app by Android users. As shown in the answer to this question, Firebase automatically tracks uninstalls in that case.

Maybe you want to use Firebase Analytics and the event app_remove. Mark it as a conversion and use Functions to remove the user from your Firebase Project(if anonymous) and/or any other data associated with the user(Storage, Database, Firestore, etc.) or anything else you might want to do upon user removal of the app.

Related

time limit android application

I created an android application that has Firebase as the back-end and everything's working fine, from registration to authentication... but I need to add a feature where the user can only push A button once every 10 days for example. Now I used the sharedPreferences method which does the trick but it only sets the limit per application, in this case a user can uninstall and re-install his application and he would bypass this "time limit". I need to know if there's any function, a cloud function per-say, that limits the button click per registered user like for every user there's his proper time limit no matter if he uninstall and re-install the app or use another phone. Each Firebase user = proper time limit.
obviously information about button click (timestamp?) should be stored outside device, as app may be re-installed as you noticed. so you need some storage API, a server-side
if "registered user" is registered using Firebase Authentication then you may use also Firebase Storage or even better Realtime Database for storing infos about clicked buttons tied to particular users
PS. be aware that Firebase isn't free, well, not every component... web/mail auth is fully free, but sending SMS costs, so is limited in free plan. Storage have more limitations, like traffic or size limit, so be awared that if your app will spread around you may be forced to move to "blaze plan"

how to disable network usage for other application in android programmatically?

i have bought new android 10 just some days ago . i was using android nought for a long time . i was looking in the setting and i found that i can restrict particular application for using mobile data .
i tried and turned off mobile data for many application and i found that , restricted apps were not able to access interent and my battery life has become much more longer .
i am android developer and i had created an application like Alarm manager which notifies user on battery charging on specific percentage than had added something like battery saver , which basically does nothign except showing ad. so i decided that how can i add this mobile data restriction feature to my app .
i tried to google it but found nothing , i guess i need to make my application Admin , i don't have much idea about admin but i know that i would be able to make as many changes as i want in my application .
is any body has idea what can i do in this situation . i have not seen any simliar app on play store as well . but it could be possible that i would have missed those apps .
I don't think you can toggle connectivity for other apps from your own app, doesn't seem like the system would allow that. You COULD look into a VPN app that can inspect network connectivity, and block requests from specific apps. But I'm not sure how much battery that would save you.

Do I need a server to send PDFs created in my app to the same app (different account) on another device?

Beginner here.
I'm creating an app in Android Studio (Java) where the user can create and store PDFs on the app and send these to another account on the same app, on a different device.
The user will have a list of contacts stored in a database.
Do I need a server to do this? Are there any tutorials online showing one how to code this? (I've been searching for hours but can't find anything specific to my problem. Maybe I'm wording it wrong...)
I was looking into Firebase but I'm completely lost on where to start.
Thanks!
For simple use cases you don't need a server, you can use firebase instead. Currently, they have a storage feature that lets you store files on their servers and retrieve them later.
Here is the official documentation firebase cloud storage
One thing you could do is upload the file from android device and download from another one.

Android GCM not letting me sleep

I've made two apps to work with GCM notification in one I've done that using my own php server to store reg ids and then send notification to app users using GCM . and i've coded it myself in java also to receive that notification successfully i've done that using documentation of Google Cloud Messaging
So in 1st app which i coded manually i'm getting all notifications as i was expecting then there was problem that screen was not getting on while i receiver notifications . I've accomplished that also using WAKE_LOCK.
Even my app not present in ram of device which we mostly now a days we use hold on menu button and clear ram.
but still i get notifications.
Ok so here 1st app story ends.
Now let's go towards second app
I've made that using https://onesignal.com SDK
That was so amazing and easy and i've done it earlier.
just this line of code did all.
OneSignal.startInit(this).init();
So every thing is working and all is done . But problem is that when this app is cleared from ram like i defined above i don't get even single notification then to be sure more i check my cell phone running app section and i was not able to find my 1st and 2nd app there but i found google play services running 5 services when i tapped on that i got that gcm is also running . So i'm not getting that what can be the issue with 2nd app ? what i should do to make it like 1st one with this sdk
I'm really very worried and any help will be appreciated thanks.
Just to confirm in your 2nd app with OneSignal you are sending a new notification from OneSignal each time? If you're replaying a GCM payload the OneSignal SDK will omit processing it to prevent duplicates.
Which device and Android version are you seeing this issue on? Test on multiple OS versions if possible.
Also check the logcat when you kill your app and when you send a notification from OneSignal. It sounds like your app could be getting put into a "Force Stopped" state. See the following gist for an example of the logcat messages that show from this.
https://gist.github.com/jkasten2/fb83b1df754cf26df378
Thanks.

Updating android APK not via play store

First of all, I'm sorry I don't speak very good english. I have a thesis project to make android app similiar like logo quiz using java. Basicaly, I have to make the admin site of this app or make it updatable not via play store. I'm going to put the newest APK version in a website host. Does anyone here know how to make it work like that? Or maybe you have another idea to make the admin site? please tell me
The update also must be installed. The user will check is there any newest version. Then user will download it and the downloaded APK will be automaticaly installed
This is not easy to do. The only option you have is to write some server side code to let a client know what the latest version is. The client can trigger a local notification and alert the user that a new version is available.
Facebook managed to do what you're asking but I'm sure a lot of engineering effort went into it.
[EDIT]
Google has updated their policy to forbid dynamic updates.
“An app downloaded from Google Play may not modify, replace or update
its own APK binary code using any method other than Google Play's
update mechanism.”
FYI Without uploading on play store, user will never come to know about the updates of your app.
Or
There must be some kind of notification you should implement in your admin and send to your users using the app, and through that notification you should ask user to download updated APK from your web.

Categories

Resources