I have made an basic app when the user selects any random number between 0-99 , and at sharp 8 pm, this app randoo selects one number between 0-99. If the randomly updated number matches with user's selected number then that user is the winner.
I have defined one class, which says that , if time ==8pm then connect to database and check whoever have selected the number which matches to randomly generated number. If there exists any, then update their name to another table.
But the problem is, atleast one user should open my app at sharp 8pm. If no one opens my app at 8pm, then the table won't be updated.
I want my python code to run at Sharp 8pm on Android.
I have heard of AlarmManager ,but don't know how to implement it in Python.
How can I solve this issue?
If there are other methods than AlarmManager also, help me out.
We can do it using Wayscript. Wayscript helps to trigger any python function. Create a python file in way script website and set triggering time exactly at 8pm daily.
This worked for me.
Related
I am working on app locker to show lock on selected apps by getting top applications's package name. For this purpose I'm calling the method in my service every 1 second to check which application is on top. I have implemented the answers given in these links https://stackoverflow.com/a/28066580/13005440 , https://stackoverflow.com/a/38829083/13005440. Its not working properly in my pixel 2 (Android 10) device. The above methods return correct package name for some apps like youtube when it opens first time / after minimize but not for other apps like messages, playstore etc. I want to implement my app lock on app minimize.
Note: When applications (messages, playstore etc) open 1st time it returns correct package name, but when that application goes to background by minimize then re-open app the method will not return its package name.
I have searched a lot but didn't find any way that will work on android 10 properly
As someone pointed out in the thread you got your solution from, are you giving the right permissions?
You need this one:
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>
I would like to know which users have uninstalled my application so that I can ask them for a feedback to improve the app. Hence, I would like to detect when the user has initiated the uninstallation process on my app.
One of the older solutions on StackOverflow had the following steps:
List< ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(MAX_PRIORITY);
String activityName = taskInfo.get(0).topActivity.getClassName();
if (activityName.equals("com.android.packageinstaller.UninstallerActivity")) {
// do whatever is needed
Since Lollipop, getRunningTasks has been deprecated. So how can com.android.packageinstaller.UninstallerActivity activity be detected without getRunningTask?
Alternatively is there any other method to detect uninstallation process has been started on my app? Using getAppTask probably?
Apparently you wont be able to do this, you will have to rely on something called silent notification.
What we did was we sent notification every 3 days or whatever frequency you want.
On the client side as soon as a notification is received we hit a network call which mark NotificationReceived for the client. Now since notification are not full proof we assumed a threshold of 2/3 missed notification as uninstall event. And for the client we have this counter above decided threshold we contacted them for feedback.
Also no one will be willing to fill your form at the time of uninstallation as user has already decided to uninstall your application.
Read these 2 questions and answers:
native solution
GCM solution
As I know you have to mix the two. Read the limitations of first solution. You have to confirm uninstallation event of the first solution with the second solution for a complete implementation.
Hopefully, this solution will work for you. It helps you understand the reasons for your app uninstalls, reduce the uninstall rate using a powerful predictive engine and also get app Re-installs through a unique actionable channel (Android version 4.0 and above).
Just set a variable named appLastPresent for every user in the server-side and update that variable every day by calling an API using WorkManager's PeriodicWorkRequest. Also set installedDate variable when the user installs the app.
Now set up a chron job on the server side to check if the difference between installedDate and appLastPresent is greater than 7 days. Then send the user an email or message enquiring for issues or feedback, if it is greater.
NB: User can be offline for 7 days. Therefore only send email enquiring like why you are not using the app, if uninstalled please let us know why
mmm...I have a task to get internet speed test,ping, download speed, upload speed, and etc by using Ookla on android... I already know to lunch Ookla programmatically using an intent, but the problem is when ookla is launched, I need to press "begin" test button to run internet speed...Here I just want to begin ookla internet speed test without using user interaction...So when the ookla is launched I want to begin the test automatically too... Is there any way for doing this..??? like sending something from my launcher intent..? or mmm... I don't know exactly...
Thanks in advance...:)
Note:
*sorry for stupid question may be.. :)
*I have found a project for doing this speedtest programmatically, but it needs a server. and I don't have or don't wanna use a server here.. :)
Is it possible to get count for,
How many times a third party application has run so far..? (It can be number of times after boot or number of times after user installed it).
Actually, I am showing a list of application for user to choose which application they want to install first. Requirement is to show the list in sorted order. Order should be where 'least used application' is shown first & most used application is shown at last.
I have seen some of the stuff mentioned in Greenify application, but then again that application requires root access which can also meant that 'this' information is available only if you have a root access.
Hope the my query makes sense.
This is an extension to the question here. Now I quote CommonsWare
There is no reliable way to retrieve mobile number of device programatically. The only option remaining and I can think of is getting user to input for the phone number.
My question is how to check if the phone number entered by the user is correct for these and any more possibilities which I cannot think now:
The number entered by the user is of the same device the app has been downloaded on.
User did not make any typographical error while entering the number
User did not enter any local calling code like leading 0
I have spend sufficient time on StackOverflow and web and this is not a duplicate question.
I will appreciate any help, clues or suggestions.
1.The number entered by the user is of the same device the app has been downloaded on.
Again this is something kind of impossible to test, else the Tricky way mentioned by #neteinstein
2.User did not make any typographical error while entering the number
3.User did not enter any local calling code like leading 0
I think you still not aware of this library by google,used for Parsing/formatting/validating phone numbers for all countries/regions of the world.
Using that you can achive your other 2 solutions.I think.
Link : http://code.google.com/p/libphonenumber/
If you are willing to possibly spend some user money you can send an SMS to yourself (number inputted by the user) and check if it arrives.
If it does, the number is correct. If not... either you have no network, or the number is incorrect.
I don't even think the phone has the number visibility, according to my experience with Mobile Operators, only on their side they have that visibility.
Though I do not know about nr1, I think you can solve problem nr 2 and 3 quite easily by analysing the number while its a String. That way you can easily check what characters it contains and what positions these characters are on.
I hope this helps.
Greets,
Wottah