Our project is 5 years old project in Android native.In that we have used Asynctask to make an API call in each and every screen.
As per the documentation Asynctask got deprecated from Android 11 onwards. Currently our project is in play store and there are n number of active users.And it's working fine with android 11 devices also without any issues
Here I have 2 queries
1)Still Asynctask is working fine with Android 11 OS and below versions.Will it affect android 12 OS.I haven't get any clear information about completely removal of Asynctask in android developer site also.
Do I need to take this as serious and have to update my whole project with the replacement of Asynctask?And will it affect upcoming OS versions?
2)If I want to replace that means what will be the best option without making much code changes. Even google suggested some API frameworks like concurrent and coroutines as the best replacement.But I didn't get idea about replacing in existing classes.Because in and every class we are calling AsncTask to make API call.and in onpostexecute we are handing response parsing.
Please suggest some alternate options which will not make much code changes and effective performance..
Thanks in Advance.......
Here I have 2 queries
Just 2? You sure about that?
1)Still Asynctask is working fine with Android 11 OS and below versions.Will it affect android 12 OS.
It's highly unlikely.
I haven't get any clear information about completely removal of Asynctask in android developer site also.
Correct. One would assume (hope) Google would make a very public announcement if and when they decide to remove it completely.
Do I need to take this as serious and have to update my whole project with the replacement of Asynctask?
You need to take this a warning that you should stop using AsyncTask and replace its use in your code if you have time.
And will it affect upcoming OS versions?
No one but someone at Google could answer that, and they're not going to.
2)If I want to replace that means what will be the best option without making much code changes. Even google suggested some API frameworks like concurrent and coroutines as the best replacement.But I didn't get idea about replacing in existing classes.Because in and every class we are calling AsncTask to make API call.and in onpostexecute we are handing response parsing.
"The best option" is going to depend on your code. Google around for "asynctask to coroutines" or something along those lines and you'll find plenty of blog posts on the subject.
Related
I'm building an Android Launcher for the elderly, using Android Studio, and I'm trying to change how the UI of an ongoing call looks. I want to know if it's even possible.
I know I could do it by building a Custom ROM, but that's not a solution for me. I'm asking here, because I can't find anything online about this. All I could find was this.
I tried reading the last link 5 times now, but I can't figure out what to do. I feel like I'm overcomplicating something very simple. Remember, I don't want to change how calls are made, nor change any routines and listeners. All I want to change is the user interface.
What I want to change:
Default ongoing android call look
I am trying to develop an app which auto receive calls from particular numbers.
Like i can add the numbers that i want to auto receive. I did a lot of research and found similar questions but none of them worked. Some codes did work but only upto kitkat version and code did not work on versions above kitkat. I want the code that support all android versions. Its very important for me so please answer quickly. I really need your help.
I want the app to work in background so also please help me and write the code to implement this in a background service.
I was successful to run the app on versions upto kitkat but above kitkat the code does not work.
Android very specifically does NOT allow this, because doing so is an opening to a lot of telephone scams involving reversed charges. They've actually never allowed it, but people found hacks on old versions to get around that. Every time Google finds one of these, they shut it down in the next version. So there is no reliable way to do it, and if you find a way expect it to disappear shortly afterwards.
I'm having quite tough problem while developing a testing framework for android apps. The text got a bit long so the actual question is in bold for those that don't want to read the context.
Basically, what I'd like to achieve right now is to trace user activity while he's using the application as one of the features. There's my app that manages context data all the time and developer's app - the one being tested. My idea to do this was to get coordinates where user touched the screen along with taking a screenshot simultaneously. Then I'd use the coordinates to mark the spot on the screenshot to get the idea of what user was doing the whole time with the app. Take hints on user experience and trace crashes.
Non-system apps cannot take a screenshot for security reasons, but application itself can take a screenshot of its Activities without much trouble for non-rooted users, e.g. like here. My only hope here is to interfere with developers' code to implement the functionality of doing so while my testing app is running. Each Activity then would have to extend my overridden Activity instead of regular one, implement an interface, implement broadcast receiver etc.
I am going to write a library for developer who would like his app to be tested with my framework. I'd like it to do the job for me and be as non-intrusive as it's possible for him to use. How to achieve that the best way?
Ideal case would assume linking the library to project with maybe a small addition in manifest that'd get the job done and after just unlinking, removing that bit of xml in manifest for production.
That's an open question. I don't expect any bits of code, but some nifty Java trick, Android OS functionality or even completely other approach that'd solve my problem
I tried to be as clear as possible with the question, but that's a quite tough matter for me to describe so that could have turned out contrary. Don't hesitate to ask me for more details, to speak my mind more clearly or even rewrite the question. Thank you all very much for help!
I have a great idea for an Android app, but as I'm only familiar with php/js, I'm uncertain of which approach I should choose for creating it. The app will be based on a google map with a lot of position markers. There won't be any fancy animations or other heavy resource-demanding activities.
As I see it there are three different options:
Read up on Java and program the whole thing in Java
Create the map activity in Java as a mapview and then use webviews for the other activities (which can easily be scripted as html5 webpages.)
Script everything as a webapp (not really an option, as this is not a real mobile app imho.
I'm most keen on using no. 2 as I'm quite familiar with html/php/js/mysql. Have to read up on the html5 specifics, though. Questions:
I need access to GPS and camera hardware. Is that acheivable in webviews?
How complicated is it to pass variables between js in webview activities and java in other activities?
How big a difference in performance can I expect if I use option 1 vs option 2?
Other thoughts?
Kind regards,
Anders
You can choose number 2, but as we are talking about an android phone, you might want to get really accurate coordinates for your map, and you can only achieve this by accessing your phone GPS, through webviews the best you can get is the location trought the device internet IP adress, wich doesnt lead to a very accurate geo position.
The best choice is a 100% java application in my opinion.
1) Yes it's possible, but as commented it will be less accurate and probably slow.
2) Not complicated. Painful if you need loads of interaction between a webview and native app. Using a Javascript Interface that can be set up from the native app. You can basically inject javascript in a webview's html.
3) Heterogeneity of performance depending on device. Because your implementation will be based on the device's browser you can expect to get really sluggish behavior for older devices. Anything to do with HTML events (Dragging, Tabbing...) will have a knock on most devices, from my experience.
4) As #vodich comments there are other party frameworks. My benchmarking on PhoneGap and other js-based options is that they're a waste of time if you are looking at developing a professional app. I haven't developed on Adobe AIR but find a pain the need to be installing plugins to get native functionality (access to sensors, camera, etc) Mobile is all about fast, responsive behaviour. HDI is your finger, user is fast, so app needs to be fast.
EDIT: So hell yeah! Java FTW!
Albert.
4.Other toughts?
Yes, if you really want to make a great Android app, you should be using only Android and specific Android UI components, and give it a native look and feel. And regarding 1,2 yes it is possible, I would say not so complicated to just integrate them, but I think you'll eventually get in big problems.
Learn Java and write your application natively.
Webviews might allow you to use your php skills to present something to the user, but it's entirely one-way - you'll not be able to interact with what's inside.
The Android developer site offers fantastic documentation and jumping from PHP to Java isn't greatly difficult, though you'll need to get used to strict typing and "real" OOP.
Other thoughts? Don't go down the PhoneGap/Cross platform toolkit road - it might allow you to write applications for multiple platforms and using your current skills, but in the end you get a subpar app that doesn't feel right on either platform and doesn't fair well as future versions of iOS and Android are released.
I am currently creating an app and would like to create a demo version (free) and a full version.
However, I am wondering how I can set some sort of flag so that when the demo version has been used 5 times, you have to buy the full version to continue using. This usage will be detected on a submit button.
I was considering setting a flag in the app, however releasied that the user could uninstall the app and then re-install it overcoming my set flag (as this would set it back to 0).
Has anyone got any clever solutions for my little dilema?
Thanks
You might want to try one of the techniques in this answer: https://stackoverflow.com/a/996288/1205715
I think that is not possible with an local application.
File saving to sdcard with strange filename can be a way but It is not perfect.
In my opinion, Right way is using an application server that manages user run times with unique UUID.
It might also be worth thinking about an alternative approach.
In app purchases are now available, so you could have a free and a restricted section in your app, and use the in app purchase to unlock the restricted section. You see more developers going with this approach these days, rather than managing two versions of the app.
Also worth considering the fact that if you have a paid version of the app it can be pirated pretty quickly, one person just needs to get their hands on the full apk. However, if you go with the in app purchase model you will be letting google handle a lot of these issues for you.... just a thought, and the road I will be taking with my next app.