Android development

Table of Contents

related androiddevandroid

Android studio plugins androiddevsetup

  • ADB Idea
  • Bash support
  • CheckStyle - IDEA
  • Drawable importer
  • Findbugs - IDEA
  • IdeaVim
  • Lombok
  • Markdown
  • Python support
  • Sqldelight
  • Teamcity

Phone apps androiddev

  • Cheatdroid: shared prefs editor

[2015-11-20] Why asynctasks are bad? androiddev

  1. AsyncTasks are not composable, To run two (or more) dependent asyncTasks you need to run one from another.
  2. Error handling needs boilerplate: To handle error in main thread you need to return null as result (and losing error information in onPostExecute), or wrap your result in some kind of Either, where you provide result or error
  3. AsyncTasks force you to handle result in main thread (even when it's intermediate result, and should not be handled in main thread yet)
  4. And of course Activity/Fragment lifecycle, but that's the point why loaders were introduced.

[2016-04-06] running strace on device androiddev

setenforce 0  # In Android 4.3 and later, if SELinux is enabled, strace will fail with "strace: wait: Permission denied"
set `ps | grep zygote` ; strace -p $2 -f -tt -T -s 500 -o /sdcard/strace.txt

debugging with adb androiddevadb

Wireless adb: androiddevadb

adb shell netcfg

Clearing the app data androiddevadb

adb shell pm clear

Start an activity androiddevadb


# example
adb shell am start -n com.growingwiththeweb.example/.MainActivity
adb shell am start -n com.growingwiththeweb.example/com.growingwiththeweb.example.MainActivity

Start service androiddevadb

adb shell am startservice -n ""

Debug activity/service starts androiddevadb

logcat -b events | grep "google.mail"

View activity stack: androiddevadb

adb shell dumpsys activity activities | sed -En -e '/Stack #/p' -e '/Running activities/,/Run #0/p'

Run certain tests: androiddevadb

adb shell am instrument -w -e class,

TODO [C] [2019-08-28] I made something to turn any mobile website into an iPhone app… /r/webdev androiddevandroid

Why you didn't use the tags?
><meta name="apple-mobile-web-app-capable" content="yes">
><meta name="apple-mobile-web-app-status-bar-style" content="black">
It works amazingly with Chrome:
You get the App icon on your screen, full screen, etc!

TODO [C] [2019-08-28] What is the difference between PhoneGap and Ionic? /r/learnprogramming androiddevandroid

Ionic is just a UI.
Think of all the UI peculiarities when you use your iPhone. Now imagine trying to hand roll all of that in CSS. Doable, but a real PITA. That's why Ionic was developed.
Phone gap is a totally different thing and is what compiles your code into somethin iOS or android understands.

TODO [C] [2019-08-28] Do people use plain Cordova to build apps ? Or do most people use it in a framework like Ionic or PhoneGap /r/javascript androiddevandroid

Using cordova on it's own has grown out of fashion due to the amount of things you are required to set it up to make it look like a semi decent app. That said, there are those who still do that, but they likely have a suite of things they've developed over time to make use of it.
Phonegap isn't a different framework though, it's the non open source version of Cordova that is marketed by Adobe.
Ionic is the framework you'd most likely be looking, as they do provide a number of useful mobile components, and styles.
You could also look into React Native, as the community is growing at a faster rate than Ionic did. It doesn't use Cordova at all, but rather the JavaScript runtime on iOS & Android to make use of the platforms' native UI components.

TODO [C] [2019-08-28] PhoneGap/Cordova vs Ionic vs React Native /r/webdev androiddev

Ionic is basically Cordova with Angular on top with a convenient CLI. In my experience Cordova apps tend to be laggy in the long run and the debugging process is relatively annoying when trying to debug native plugins (you have to build the app via xcode etc.). You should be aware that Cordova uses the web view to display the app. So it’s kinda like running a web page on your phone and trying to convince the user it’s a native app.
React native on the other hand uses the native components of the OS. So it’s not a web view, which means your app will feel much smoother. The downside of react native is that it uses its own components on top of the native ones which makes it hard to reuse your frontend code to the extent you  could with a Cordova app.
Personal opinion: In my opinion and based on my past experience I would go with react native if I had to choose a framework based on JavaScript.
Hope this helps :)

TODO [C] [2019-08-18] JStumpp/awesome-android: A curated list of awesome Android packages and resources. androiddev

[D] [2019-10-11] fastlane/fastlane: 🚀 The easiest way to automate building and releasing your iOS and Android apps androiddev

[D] [2019-06-12] udev - Android adb no permission - Ask Ubuntu androiddevadb

Change the USB mode in your phone to File Transfer. That's what worked for me.

[D] [2019-12-27] How to Debug a Third Party Android App | Lobsters androiddev

[C] [2021-01-11] Allow using a different directory than Documents for local storage · Issue 999 · jonasoreland/runnerup androiddev

The problem is scooped storage in newer Android versions. An app only has access to its specific directories.
With older Android than 10 it is possible.
This piece of code need to be changed when targeting Android 111 (before next fall) as getExternalStoragePublicDirectory() is not supported then.
Jump to search, settings & sitemap