How to avoid hardcoded urls in IOS/Android app - android

I'm developing a django web-project and I'm going to develop its IOS and Android API.
Is there a way to avoid using hardcoded url addresses in the app code?Something like django url name system
The following problem faces me if there isn't any solution to my question:
If I want to change some of my urls, I should change the app code and also all the previous installed apps on peoples' devices won't work and should be updated.

The way I see it, you probably have two options:
a) Code very generic forwarding links into your app, such as:
http://www.example.com?linkid=1
http://www.example.com?linkid=2
You can then, from your side, forward these on to where you need them to go by using the query string ID number.
b) Write a web service to push updated URLs to your app, maybe on load so you're not polling the service all the time.
How often are the URLs likely to change?

Related

How to send text message to Azure Bot?

Totally new to Azure and the services it offers, I face many questions about the "Speech" service and the bots that can be created on the Microsoft platform. Currently developing an Android mobile application I'd like to realize the following behavior:
The user records a voice file from the app (using MediaRecorder), this part is ok
Once the recording is finished, this file is sent to Azure function(via an HTTP POST).
The file is translated into Text
The text is sent (step 7) to the bot which reacts accordingly by executing an HTTP request.
Scheme of the process I explained
First of all I wanted to know if this scenario is possible or if I have to use the Speech SDK on my Android application.
Moreover if this scenario is possible, how do I send the text to the chatbot? I've checked this link but it doesn't seem very relevant to me.
NB: My bot has been completely created using "Bot Framework Composer" for the moment, no code has been written, I just wanted to know if my scenario is plausible and above all possible.
Go through your steps, and I think it can be implemented. If you want to send text to bot, you can refer to this request.
Before that, you may need to start a conversation and get the conversationId.

Where do I put code that links app to Twitch OAuth and channel chat

I'm currently using Android Studio 3.0.1 to build a very small android app that will be used to send specific chat commands to the users twitch channel chat. It's been quite a while since I've dabbled and as such I'm getting lost with where to put certain things
Essentially what I need the app to do is two fold. Firstly I need to present the user with the Twitch authentication page on first open so that they can authorise the app to use their twitch account/channel. Then I have a single screen with buttons on it. Each button calls a certain string, and what I need to do is pass that string into the users channel chat
I've got virtually all the code required to connect to the twitch API and generate the OAuth request, as well as code connecting to the channel and code to push commands from the buttons out to another endpoint. What I'm struggling with is the following:
Where do I put any of this code? Where am I putting the twitch OAuth request code etc? Do I create a separate Java class for it?
Once I've got the code in and working where is the data being stored and how do I then call it elsewhere? I guess this might get answered once I know where I'm actually putting the main code
Obviously the app will be used by multiple users so I assume I'll be creating variables for usernames, OAuth tokens etc and then will call them from other areas. I'm just unaware of how to get this done in the current Studio version and while I can find lots of references to what code to use, and plenty of examples of how to make code work I can't seem to find any info on where to actually put any code
I've abandoned android studio for now. no matter what I tried I can't get things working. switching over to another method of working using html/js/css and I've got so much further

connecting with web server using android app & nfc tag

I want to build an android app, that when you put your phone on nfc tag, the app connect to server (I suppose database will be in web server) and get the data from database, and when you put a phone on second nfc tag it connect again to server, but this time gets diffrent data from database(must be there new database).
So basically I' am new to servers and databases and if this is posible what I mention above or at least a similar. Can you provide me with some tutorials that I can learn from and will help me build this.
Please go through the following link,
http://developer.android.com/guide/topics/connectivity/nfc/index.html
It has all the tutorials on how to utilize NFC on Android. It has certain API's available as well which you can use. The part where first it does a different operation and the next time a different one all depends on you on how you deal with it. You can write a condition based on a boolean value to see if its a first time or second.
Hope this helps.

Is there a way to pass a variable to an aspx file via the url?

I am trying to write a little Android app for my daughter. The goal is to scan a book's bar code and pass the ISBN number to this website: http://www.arbookfind.com/default.aspx . The result will show if the book is part of the Accelerated Reader program and how many points the book is worth. I am trying to automate the part where the ISBN would need to be entered into the search field.
For simplicity's sake, and because I'm not a programmer, I am using MIT's App Inventor 2. I can now scan and get the ISBN but I will need to know how to format a URL to the website that will allow me to pass the ISBN to it's search page.
Is it possible to send a variable via the URL similar to index.php?myvar=testing&someothervar=somethingelse ? I've tried but perhaps I am not using the correct variable name or format for aspx. Is there an easy way to see what the variable name is in the aspx displayed page in my browser?
EDIT To clarify, I am not trying to scrape data and avoid showing ads from the site I am using to generate the results. I am wanting to pass the ISBN number to the page and have it search and display the resulting page in the phone's browser. I am also fine with a method that would populate the search field and the user would have to hit the search button if that can be accomplished easier.
I would recommend abandoning this route, as it is highly unlikely that the owners of this website will want you passing a query string to their site anyway, but rather they will most likely point you to an Application Programming Interface (API) that they provide, so that your program can connect to this service (free or paid, depending upon the company) and then you can request the book's details by providing the ISBN in the request.
There is no discovery mechanism for an .aspx page like there is for a web service to find out the names of things to pass. Even if you figure out what the name of the query string is that you could pass in for ISBN, you run the risk of the implementation being changed and your "application breaking". While this is also true of web service APIs, since APIs are the route the website providers want you to use, as opposed to screenscraping, then they generally inform their users of breaking changes or newer versions of the API via documentation.
From what I can see that page does not accept URL-variables for their search field the way google.com and other does. The page is generated through some sort of content management system (CMS) and it relies heavily on javascript to make things work. I tried doing a normal search there, and you have two issues you need to wriggle around.
First, the page redirects you to a page where you select if your a student, parent etc. It seems that it relies on some session cookie to remember the setting, but it times out pretty fast.
Second, the form uses javascript to trigger the search, and it appears to be done using AJAX, a method of using javascript to trigger actions on the server and displaying the results, without actually loading the page again. You might be able to get a hold of the javascript code used and re-engineer it for your purposes, and call that using HTTP POST and/or GET from your app, but it is a tricky path, and quite possibly not allowed by the company since you will be loading data from their site, without presenting their advertisements and thus be costing them money.

Put some values on internet to access from android

In my app a user can (only) see the values uploaded by admin.
For example. A salesman is using the app will be able to see the latest rate provided by the manger to trade.
Now the question is "where to put these values?"
I have .net webservice experience with android but I guess it wont work in this scenario,will it?
Any suggestion that the returned result be in (preferably) XML format.
It sounds like you already know how to do this. You can download and parse xml within your app. If you alreayd know how to set up the websever, the rest is easy. Limiting who can see what is just a matter of associating specific transactions with an individuals account. Then just have the phone check for updates on that transaction when the app loads (using someting like AsyncTask) or if you want to get more complicated you could push notificatinos using the android cloud service, or even use a REST model. More details are needed for a more specific answer but you can do what you want.
You can do it on your own, and build a webserver with a MySQL/PHP JSON API or you can use parse.com for a smaller project.

Categories

Resources