preface

I have heard many people say that Android learning is very easy, do an App to get started, there are more job opportunities, it is easier to find a job after graduation. This perspective is probably one of the reasons many Android developers got into the game in the first place.

At the beginning of my work, I mainly realized the functions of the App page according to the business requirements and realized the effect of the page according to the designer’s design draft.

In the implementation process, the following requirements are always raised:

Can this word be bigger or bolder? I feel the color is different from the design draft, can you adjust it again? Why do you keep falling apart, all right? .

So, after a year of work, you’ll find yourself looking for all kinds of components, frameworks, dragging and dragging, changing styles. ** I don’t know how to solve the problem in extreme cases (such as crash on some models and slow loading of pictures)! I’m embarrassed to say I’m a tech guy.

There are two reasons for this:

  1. The functional requirements of the App developed are not complex, and the performance does not require the pursuit of perfection;
  2. My own awareness is not enough, I don’t know how to extract the points that can be optimized from ordinary work, and I don’t have a complete plan for upward improvement.

1. Realization of componentized routing and burial points

Reference Answer:

In componentization, each business module is independent and does not depend on each other, so A business module cannot access the code of other business modules. If you want to jump from page A of A business module to page B of B business module, it cannot be realized by the module itself. This requires a cross-component communication solution — Router

There are two routing scenarios:

  • The first is page hopping between components (Activity to Activity, Fragment to Fragment, Activity to Fragment, Fragment to Activity) and data passing when jumping (base data types and serializable custom class types)
  • The second is the invocation of custom classes and custom methods between components (components provide services externally)

The principle is to generate a mapping table (data structure is usually Map, Key is a string, Value is a class or object) for some classes distributed in different component modules in accordance with certain rules, and then extract classes or objects from the mapping table according to the string when needed, which is essentially a class search

Buried points are information collected from a particular process in an application to track application usage

  • Code burying point: when an event occurs, call the corresponding interface in SDK to send burying point data. Baidu Statistics, Umeng, TalkingData, Sensors Analytics and other third-party data statistics service providers mostly adopt this scheme
  • Full buried point: Full buried point refers to the reporting of all behaviors that meet certain conditions generated in the Web page or App to the background server
  • Visible buried points: Configure the collection node using a visual tool (such as Mixpanel), and automatically parse the configuration and report the buried point data on the Android terminal to achieve automatic buried points
  • No burying point: It does not really need burying point, but the Android terminal automatically collects all events and reports burying point data, and filters out useful data during data calculation at the back end

2.Hook and pile insertion technology

Reference Answer:

Hook is a technology used to change the result of API execution, which can redirect the system’s API function execution (the triggering event and background logic processing of the application is executed step by step down according to the event flow. Hook means to intercept and monitor the transmission of the event before it is transmitted to the destination, just like the event on the Hook, and to deal with some specific events when the event is hooked, such as reverse cracking App).

Hook mechanism in Android, there are roughly two ways:

  • To root permission, Hook the system directly, you can kill all apps.
  • No root permission, but can only Hook its own app, no other app in the system.

Pegging is static modification of the third party’s code, that is, from the compile stage, the source code (intermediate code) is compiled, and then repackaged, is static tampering; Hook, on the other hand, does not need to modify the source code or intermediate code of the third party in the recompilation stage, but modifies the call at run time through reflection, which is a dynamic tampering

3.Android signature mechanism?

Reference Answer:

Android’s signature mechanism includes message digests, digital signatures, and digital certificates

  • Message digest: Executes a one-way Hash function on the message data to generate a fixed-length Hash value
  • Digital signature: A method of storing message signatures in electronic form. A complete digital signature scheme should consist of two parts: a signature algorithm and a verification algorithm
  • Digital Certificate: A file digitally signed by the Certificate Authentication Center that contains information about the public key owner and the public key

4. Big changes between Android5.0 and 10.0

Reference Answer:

4.1. Android5.0 new features

  • MaterialDesign design style
  • Support for 64-bit ART virtual machines (ART virtual machines in 5.0, Dalvik before 5.0). The difference between Dalvik and Dalvik is that the bytecode needs to be converted to machine code (JIT) by the just-in-time compiler each time it is run. ART, bytecode is precompiled into machine code (AOT) when the application is first installed.
  • Notification details can be designed by users themselves

4.2. Android6.0 new features

  • Dynamic Rights Management
  • Support quick charging switch
  • Support folder drag and drop applications
  • Added professional mode to camera

4.3. Android7.0 new features

  • Multi-window support
  • V2 signature
  • Enhanced Java8 language patterns
  • Night mode

4.4. New features for Android8.0 (O)

  • Optimized Notification: Notification Channel Notification flag Sleep Notification Timeout Notification set Notification clear
  • Picture in picture mode: list the Activity set android: supportsPictureInPicture
  • Background restrictions
  • Self-filling frame
  • System optimization
  • And so on and so forth

4.5. New features for Android9.0 (P)

  • Indoor WIFI positioning
  • “Bangs” screen support
  • Security enhancements
  • And so on and so forth

4.6. New features in Android10.0 (Q)

  • Night mode: Dark mode can be set for all apps, including those on your phone.
  • Desktop mode: Provides a PC-like experience, but is no substitute for the PC.
  • Screen recording: Enable by long pressing “Screen snapshot” in the “Power” menu.

5. Say Measurepec

Reference Answer:

Function: widthMeasureSpec and heightMeasureSpec determine the size composition of the View: a 32-bit int value, with the highest 2 bits representing the SpecMode and the lowest 30 bits representing the SpecSize.

Three modes:

  • UNSPECIFIED: The parent container has no restrictions on how large the View is. Often used within the system.
  • EXACTLY: The parent specifies the exact size of the child’s SpecSize. Corresponds to match_parent or a specific value in LyaoutParams.
  • AT_MOST(maximum mode) : The parent container specifies a maximum SpecSize for the child View. The View cannot be larger than this value. Corresponds to wrap_content in LayoutParams.

Determinants: The value is determined by the child View’s layout parameter LayoutParams and the parent container’s MeasureSpec value. The specific rules are shown below:

6. Please give examples of common layout types in Android, and briefly describe their usage and typography efficiency

Reference Answer:

Common Android layouts are divided into traditional layouts and new layouts

  • Traditional layout (writing XML code, code generation) :

    • FrameLayout:
    • LinearLayout:
    • AbsoluteLayout:
    • RelativeLayout:
    • TableLayout:
  • New layout (visual drag-and-drop controls, writing XML code, code generation) :

    • ConstrainLayout
  • LinearLayout = FrameLayout >> RelativeLayout

7. Distinguish the usage of Animation and Animator, and summarize their principles

Reference Answer:

  • Type of animation: the former only transparency, rotation, translation, telescopic four properties, and for the latter, as long as the control of the property, and setter the property of the method can be implemented on the property of a dynamic change effect.
  • Actionable objects: The former can animate only UI components, but property animations can animate almost any object (whether it is displayed on the screen or not).
  • Animation playback order: In Animator, AnimatorSet uses methods like playTogether(), playSequentially(), animset.play ().with(), before(), and after() to control how many animations work together. In order to achieve accurate control of the animation playback sequence

8. What image loading libraries have you used? What is subtle about Glide’s source code design?

Reference Answer:

  • Image loading library: Fresco, Glide, Picasso, etc
  • Glide’s design is subtle in that:
    • Glide life cycle binding: can control the picture loading state and the current page life cycle synchronization, so that the whole loading process with the page state and start/resume, stop, destroy
    • Glide cache design: through (three level cache, Lru algorithm, Bitmap reuse) for Resource cache design
    • Glide’s complete loading process: The use of the Engine class exposes a series of methods for Request operations

9. How do I get around the 9.0 restriction?

Reference Answer:

10. How is the application update section done? (Grayscale, mandatory update, regional update)

Reference Answer:

10.1. Internal Updates:

  • Obtain the online version number and versionCode through the interface
  • Compare the online versionCode with the local versionCode, and the update window is displayed
  • Download APK file (File Download)
  • Install the APK

10.2. Gray update:

  • Find a single channel for special releases.
  • Upgrade the upgrade platform to allow some users to push upgrade notification or even forced version upgrade.
  • Open a separate download entry.
  • The code of both versions is typed into the APP package, and then the test framework is implanted in the APP side to control which version is displayed. The testing framework is responsible for communicating with the API on the server side, and the server side controls the distribution of A/B version on the APP, so that A specified group of users can see version A and other users can see version B. The server side will have corresponding reports to show the number of A/B versions and the effect comparison. Finally, it can be controlled by the background of the server, and all users can switch to version A or B online
  • Either way, you need to do some versioning and assign special version numbers to distinguish them. Of course, since it is to do gray scale, data monitoring (conventional data, new feature data, main business data) or to do a bit, the data pile to play. Also, gray version had better have the ability to recover, is generally forced to upgrade the next official version.

10.3. Forced Update:

The general processing is to enter the application popup to notify the user of a version update, popup can not be cancelled without a cancel button. This allows the user to update or close the app. You can also add a cancel button, but if the user chooses to cancel, the app will exit.

10.4. Incremental Updates:

Binary difference tool BSDIff is the corresponding patch synthesis tool, according to two different versions of binary files, generate patch files. Patch files. Use bspatch to combine old APK files with new APK files. Notice Versions are distinguished by the MD5 value of apK files.

11. Can you use Kotlin and Fultter? Talk about your understanding

Reference Answer:

  • Kotlin is a cross-platform, statically typed general-purpose programming language with type inference. Kotlin is intended to be fully interoperable with Java, and the JVM version of its standard library relies on the Java class library, but type inference allows for a more concise syntax.
  • Flutter is an open source mobile application development framework created by Google. It is used to develop applications for Android and iOS, as well as the main method of creating applications for Google Fuchsia
  • As for the importance of Kotlin, I’m sure you can appreciate it in your daily development. When applied to real development, you need to avoid syntactic sugar (such as single-column pattern, null value judgment, higher-order functions, etc.).
  • As for Flutter, Google’s official documentation is not yet complete. There are few projects written in this language on the market. Please refer to the official documentation for more details

conclusion

I recently collected the analysis of the 2020-2021BAT interview questions from my friends. The content is very systematic and contains a lot of content: Android foundation, Java foundation, Android source code related analysis, some common problems and so on, can help you deeply understand the principle of Android related knowledge points and interview related knowledge.

This document is a PDF of the technical points that are often asked in interviews. There are advanced architecture technology advanced brain maps to help you learn and improve, but also save you time to search for information on the Internet to learn, can also share with friends around to learn together.

Here is also to share with the majority of interview compatriots, I hope that every program ape can interview success ~

Collection method:Click direct access to Tencent documents

Android Basics

Java Basics

Android source code related analysis

Some common fundamental problems

Tencent, Bytedance, Alibaba, Baidu and other BAT companies 2019-2020 interview analysis