Android - How to prevent sms every 1 second? - java

I'm in an android project that in this I wanna prevent sms from some numbers that receive messages before go into inbox per second. Now I help that guide me how I can work this project programmatically?
I see some sample codes but I don't know how I can...

You can't do that on modern versions of Android. On older versions you could, but as of 4.3 or 4.4 Android introduced the concept of the default sms app. Only that app can write to the SMS database. And you cannot programatically set the default SMS app, only the user can set it manually.
Now if this restriction is ok with you, you can do it as the default SMS app. Whenever you receive an SMS, you need to write it to the database. If you don't write it, it won't appear in the inbox. You can then decide when to write messages or even to silently delete messages.

Related

Is there a way to issue the * commands to the mobile provider to query things like balance, minutes remaining etc from within android app?

The cellphone network provider in my area has a few functions you can do by dialing what I am calling the "star commands", that is you type and asterix(*) followed by the code of your command and press send and you are able to query account balances and a whole slew of other functions that the cell network has made available. I think this is common place among all cell networks.
I want to be able to make these commands and read the responses, issue other commands based on those responses and so on, all from within my android app.
Does anyone has experience doing this?
Those commands are known as USSD commands. You can use TelephonyManager.sendUssdRequest to send a USSD command, providing a callback to receive the result form the mobile network.
Bear in mind Android only introduced support for invoking them programmatically in API 26 (Android 8.0). If you need that functionality on any earlier Android, you'll need to do something hacky, writing some code that automates pressing buttons of the system UI

Update database on server when app is being uninstalled

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.

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.

Verify my phone number in my app

I am trying to verify the phone number of a device by having the device send a SMS to itself, but I want the message to appear like if the app was the one who send it and not my device.
Here is my project, but when I verify the number. In my inbox it appears that I send and received the message. Is it possible to do that? If it is, how can I change that?
I believe Android added protections a few versions ago that prevent you from sending hidden text messages. Someone may have a better workaround, but as far as I know it is impossible to hide the text from the user. IMO it is not that big of a deal if the user sees the text you send as long as the verification works.

How can we simulate calls and SMS in Android?

Can we simulate calls and SMS in android programmtically? Like in Windows mobile we can simulate calls and SMS.
The Eclipse Android SDK allows you to simulate receiving SMS messages and incoming phone calls (as well as fake GPS positions and the like.) See here.
I'm pretty sure adb can do it too if you're not using Eclipse.
i think you want to test SMS and Call code in android...
so this link will help you to test SMS messaging in Android ..overthere everything is explained regarding sms messaging in android...
Hope this answer suits you question...

Categories

Resources