Python Threading On Android and IOS - android

I'm knee deep in this commercial game and currently working on the in-game chat. How I code the chat system depends on rather or not threading will work.
My question(s)....
Does anyone know for sure calling a thread on android or ios will result in a separate process and not hold up the app until complete?
This worries me because I came across another python user who was developing some form of app and they stated that their thread did not run as an individual and their app froze up until the thread completed. (which sucks because python is a cross-platform language)
What I wanna do is have a thread periodically fetch chat data from the server without causing the whole app to pause while doing so. This will allow for a more professional looking chat system and better user experience.
However, if for some reason python threads will not act as expected, I'll have to use a different logic for the chat system.
I'm sure some of you will probably be like, "just test it" but that's just it....I don't wanna (want to, lol) write all that code just to re-write it all over again if for some reason threading doesn't act right on a phone.
I'm not asking for code here....God knows I can code the hell out of an alien battle cruiser from planet Zars equipped with warp 7.5 engines.
If no one can give me a for sure answer then.... (sigh)...... I'll have to just write the code and cross my fingers in hopes of accurate threading behavior on phones for python programmers or be faced with the devastating task of re-writing a large chunk of code..... on the client and server side!
=====================Update as of July 14 2017==============================
I went ahead and wrote the code anyway. Turns out the Kivy API set has some back-end issue with creating Rectangle draw instructions in a python thread. This issue doesn't seem to be relevant when creating widgets from within a thread.
I did find a work around for the draw instruction issues and had things the way I pictured it all but in the end... I saw more cons than pros in the way I was planning my chat system and decided to re-write it anyway.
The new chat system is easier to work with and I don't have to implement code and fonts for multiple languages. (phew!)
So....looking at my original question now....
Yes,
Python threads will run on their own cpu cycle on an Android phone but what you're trying to accomplish depends on your entire setup...back-end and front end APIs.
I'm surprised to see people assume python can't thread when the language has the modules for threading.
Hell I run threaded processes separate from the main thread all the time on PC. In fact, I have this nice email app which can generate emails and send out ads/flyers and maintain a valid email database.
The app uses threading to update the UI system so the user of the app knows what's going on in the background. It's a marketing tool I plan on using later after I release the current app I'm designing now.
I might even release my marketing tool but such a high quality app wouldn't be cheap on the market. Not when marketing cost so much money. Being able to reach your target audience at little to no cost... Sounds too good to be true.
:)

Related

Android multithreading logic behing a speed test

I'm currently designing a speed test app that obviously includes Ping, Download & Upload tests among others.
I already developed the logic behind the multithreaded tests so I can define create as many threads as I need for each test, being able to set multiple connections to avoid throttling for high speeds or unstable networks and having more precise results.
I'm not currently asking for code but I'm asking for the logic behind of the number of threads to use for each test for every network type and available bandwidth.
As a piece of additional information, my download test uses https connections and the upload test uses socket connections. Any required additional information, please let me know.
I've tried research about that but the only thing I could find is that Ookla Speedtest (browser version) uses 4 threads if the speed is at least 4Mbps and 2 threads on lower but browser multithreading limitations are different than the ones we have in Android apps. -> Link
I don't expect that someone gives me the exact logic behind this but it would be really useful if I could be pointed in the right direction. Any article, post, book, resource about the topic would be much appreciated.

Can I build this quiz client app?

I've been programming for over 20 years, but mostly in the VB and SQL. As a side job, I host game shows at local bars and restaurants (Trivia, name that tune, etc.) and I'd like to develop an android app that I can install on mobile devices to give to customers to interact with the game.
I'm trying to make the game shows more interactive than just pen and paper (and time-consuming, manual scoring). I can get Kindle Fires for $40 each, so I thought it would be cool to create an app that will allow the user to do 3 things:
Choose an answer from a list (Multiple choice), and everyone can answer
Buzz in (blocking other users out)
type in an answer
I'd like the tablets to send the responses to a central "hub" or application that will record the answers so it can automatically do the scoring for me. If possible, I'd prefer to be able to have everything connect through an ad hoc wifi network that I would set up on site (that part I know how to do, too).
I'm not looking to have the questions appear on the phone at this point; I have an office-based application that automates a powerpoint presentation based on questions/answers and other parameters imported from a database/spreadsheet. (VBA is nice and easy for me.)
Ideally, the quiz questions would work like this:
I project the answer where everyone can see it.
After announcing the questions, the tablet apps are "activated" and
the user can then select their A, B, C or D answer (or buzz in, or
type an answer depending the type of questions/quiz).
My hub application would then receive the following information:
team/player name, answer choice, time it took to answer the question
(because I'm thinking of using a points tier that gives faster
players get more points, either based on time ).
The catch is, I don't even know where to begin from an android development standpoint, as I have no experience in that realm. In most programming cases, I know keywords to search on, but I'm totally flying blind here.
Does this seem like a feasibly application? There are systems online that I can buy, but the buzzers are expensive and the software has some significant limitations that prevent me from spending the money. I'd rather develop something myself and spend $40 per client unit and load it up with my software.
(Then, of course, license the whole kit and kaboodle and make a mint and retire in 5 years, living the good life off of my pub quiz empire...)
So, if you have any suggestions on starting points, or specific methods and processes to being fiddling with, an IDE...any help would be greatly appreciated. Once I'm up and running, I will reward you with extra points if you ever come to one of my events.
Go full kotlin !
Android works well with Kotlin and you can have a server quickly setup with : https://start.spring.io/#!language=kotlin
https://kotlinlang.org/docs/tutorials/kotlin-android.html
A good client for Android is provided here :
https://github.com/square/retrofit
You will probably have hard time to get started. Using same language for every part of the system will make things easier.
Also, Kotlin is less verbose than Java and will prevent you to make the usual mistakes found in Java world.
Also, if you create an open source project out of it, you may be eligible for IntelliJ.
Your very first stop is : http://try.kotlinlang.org/#/Examples/Hello,%20world!/Simplest%20version/Simplest%20version.kt
Get to know the language by trying it out. When you are in ease with it, start looking at Anko (https://github.com/Kotlin/anko).
To do the project in an easy way, break it down in milestones.
Simple app which shows 4 buttons (choices) and shows a message for each button. (Eg. you clicked "1")
Small server with spring boot. It should display whatever you post to it. (An "echo" server)
Improvement of the simple app to POST something to the server and display the answer in a dialog.
At that point, you application is practically done! You would have understood enough to complete it. The hardest thing would be behind.
Don't think your are smarter than the flock. Do these milestones, at least. You will be thankful to yourself.
This post may seems unrelated, but I explain how good Kotlin can be in such projects : https://www.linkedin.com/pulse/why-do-android-projects-cost-less-than-ios-christian-baune

Importing Artificial Neural Networks in Android App

This might sound a bit of a stupid question, but I'm doing a project where I'm using an ANN to diagnose Sepsis in patients using various vital signs as inputs. The aim is to then develop an Android app that allows a user to put in the inputs and will return a risk score (% likelihood of sepsis, etc)
I'm constructing my ANN using Matlab (using their pattern recognition network wizard), and I'm using MIT App Inventor 2 to build the App itself.
Where I'm struggling, is understanding how one would actually put the ANN into the app. Can anyone explain how this works to me, or even just point me in some vague direction?
There is a matlab-compatible programming language called Octave, and it works on Android as well. You might want to take a look at it, it's called addi.
Matlab/Octave is great for scientific prototyping. Once you enter the realm of mobile applications, the best option is to re-write the libraries in Java. It could be painful but with a proper design you will be able to scale your app without depending in Matlab/Octave hacks.
If this absolutely positively has to be present on Android, on the phone itself, the straightforward way to do this is to write the software in Java and then write the Android GUI around it.
But does the software absolutely need to be on the phone? Maybe. But if not, why not make the Android part a client that communicates with a more powerful and flexible remote server? The server can implement in whatever language it likes.

Starting aFunction() in Android on app startup

This Android app developing business is accelerating the brown-to-grey-color conversion of my hair.
Can someone tell me how I'm supposed to get aFunction() to run when the app starts, seeing as I'm not supposed to make a while(true) inside onCreate()?
I've read the tutorial on Android Developer, several other tutorials, multiple questions on here, but none have answered this, seemingly, simple question. Or, at least I haven't been able to find it - without a doubt because I'm asking the wrong question to the great oracle of Amphitheatre Parkway.
The app is my first homemade non-tutorial app, and I'm attempting to make a speedometer based on GPS (obviously). Basic stuff I guess. It needs to update ever so often which I'm using Thread.sleep() for. Setting up LocationManager, getting location, calculating distance and speed is working. Printing the speed is working. Everything, except making it run, is working (he claims in his naivety).
Android development (and in fact most GUI development) is very different than the console development you may have done in the past. The main difference is that GUIs are event-driven. You typically create what are called "callback methods" which respond to events. This allows the system to do other things rather than waiting for a while(true) loop in your app. I am unfamiliar with using GPS in an Android app. You will need to research what callbacks are necessary to deal with GPS notifications. I suggest starting with Making Your App Location Aware and Location and Maps.

projecting / starting medical information app on Android

I would like to create a custom open source information management application, that I could adapt to practical needs of a psychiatrist. (and also would really like to avoid inventing the wheel). Could someone advise me what would be a good way to start? I have some amateur programming experience (see below), but I have little experience with java and eclipse (which I have set up with Android SDK plugin on my linux PC).
What I would like to achieve is a simple app where I could relatively easily re-program/rearrange information presenting screens. I would like the major development stages to be something like:
Basic framework of the app is done Main information is added
through the programming environment
basic formatting (bold, color, lists) should be supported
I imagine this would be through HTML/CSS markup Hierarchical (not
too deep) screens with concise information about conditions,
treatments; easy, not too cumbersome navigation is a must.
Possibility to attach own notes from android device
on every piece of information (e.g. on medical condition, on medication,
list of differential diagnoses, etc)
A desktop application that allows for easy adding and editing
of the content
initially could be even sqlite manager or something similar
possibility for adding images,
possibility to add rating scales, which would calculate scores
maybe also possibility to print through some android print driver
* in essence I envision this as a sort of an integrated website with a relatively simple database behind it (sqlite?) running on android. My models would be epocrates and medscape apps, but the content would be more specific to everyday psychiatric practice. It would include aspects of psychological therapies as well.
In about a years time, I think, the content would be interesting enough to see whether the app should go on the market.
My (limited) experience:
I am a MD - a Psychiatrist. I have some amateur development experience (php, html, css, Perl, bash, sed, sql, Access and some time ago - AS/400). I would like to start an app that I could modify as I go - in order to have the most useful info at my fingertips, when I need it in my work. I have considered some databases (e.g. HandDB) but my experience with them is that you get very constricted with their user interface and this hinders fast information retrieval when you need it. Adding information can be clumsy as well.
Why I am asking for help here
Most of tasks above seem pretty standard. I imagine that people with lots of programming experience here, probably would be able to point me towards some information that would help me to get started.
Many thanks for considering this :)
Are you going to develop this app? Everything you mentioned can be easily done by reading the android documentation. Although if its you doing the coding i recommend buying a book
You will find a lot of samples and other support in the android doc
Printing can be also setup using Google Cloud print
If you want to open source your application you can always use google code.
You have asked a really broad question here. But i guess the above information is good to get you started.

Categories

Resources