This article is published in DiyCode and the official account: Wu Xiaolong at the same time. If you follow the author’s DiyCode account or the author’s Microblog, you can receive the new article push in the first time.

As we all know, developing an app depends heavily on the server: the server provides the interface data and we present it; In addition, the development of an app, but also need artists to help cut images. Without interfaces and artists, it seems that apps can only be standalone or tool-based apps. Is that really the case? To show you my personal app, there is no server, no art done, in other words, I do everyone’s work:

This app is called “a lot”, he is very important significance for me, the first lot is just a try their project, I just work and technology co., LTD., a lot of just sqlite notepad app, only local operation, then slowly evolve near-perfect app now, from which I learned a lot, familiar with the whole process of the project to launch, the latest technology to practice, From a program monkey thinking to product thinking, simple Photoshop and so on. Of course, long-term accumulation will naturally bring economic benefits. Here is the sum of my app advertising revenue:


At most a month 4000 more, 4000 more what concept, than MY salary at that time are high, these “achievements” I can boast in this capital, ha ha ha!

Next, I will analyze one by one and take you to complete such a complete APP.

No server

jsoup

I overheard danniu colleagues talking about parsing HTML, and I was interested in searching what it was. I learned of a powerful thing jsoup, jsoup can parse HTML, i.e. website, so MY micro message was separated from the standalone version. To the user, they don’t care where the data comes from, whether you’re pulling it from an interface or parsing HTML, they care about the experience and functionality of the app. I concealed the fact that the data was taken from the web page. Before, too many people in the group asked me what server I used. After parsing the HTML for too many times, I didn’t want to reply again.

I choose this way has one of the biggest benefits is that the data does not need to maintain myself, cleverly avoid I will not server development, more do not need to do interface; Parsing HTML also has one of the biggest drawbacks. If the other site node changes, your app may die and must be updated in time.

Method of use

Step one:

First of all, the network request, which is used here, Retrofit, see:Android MVP+Retrofit+RxJava practice summary. To parse my blogwuxiaolong.me/For example, you can get data like the following:



In Google Chrome, RIGHT click on my blog page – view the page source code (V) and see the same data above.

Gradle app/build.gradle

The compile 'org. Jsoup: jsoup: 1.10.1'Copy the code

2, parsing HTML tips: observe HTML nodes, tags.

First observe the data we want to parse (take my blog Wuxiaolu.me/as an example). The home page has 5 elements of title, publication date, article category, article review and article abstract respectively. Google Browser only needs title, publication date and article abstract this time. The first page url is wuxiaolu.me and the second page url is wuxiaolu.me /page/2/. After that, the difference is the page number. Therefore, the app should judge the first page and other pages.






We will analyze the jsoup syntax one by one
Jsoup website.

(1) The title data structure is as follows:

 

Android App Shortcuts

Copy the code

Observations can be resolved according to getElementsByClass class=”post-title” :

//responseBody is a retrofit network request returned, converted to String, Parse (new String(responseBody.bytes(), "utF-8 ")); List titleElementList = new ArrayList<>(); Elements titleElements = document.getElementsByClass("post-title-link"); for (Element element : titleElements) { titleElementList.add(element); // Text Get the text, like here "Android App Shortcuts" logutil.d ("text=" + element.text()); / / get a href attribute values, such as "/ 2016/10/31 / AppShortcuts/" here, the blog link, http://wuxiaolong.me logutil. d("href=" + element.attr("href")); }Copy the code

(2) Data structure of publication time is as follows:

Published in 2016-10-31Copy the code

Observe, also parsed with getElementsByClass:

List timeElementList = new ArrayList<>(); Elements timeElements = document.getElementsByClass("post-time"); for (Element element : "2016-10-31" logutil.d ("time=" + element.getelementsByTag ("time").text()); timeElementList.add(element); }Copy the code

(3) The data structure of the abstract is as follows:

 
       

Introduction to the

Android 7.1 allows you to define shortcuts to specific actions in your application. These shortcuts display desktops, such as Nexus and Pixel devices. Shortcuts allow your users to quickly launch common or recommended tasks in your application. Each shortcut refers to one or more intents, each of which initiates a specific action in the application when the user selects the shortcut. Examples of actions that can be expressed as shortcuts include:

Copy the code

GetElementsByClass, too:

List bodyElementList = new ArrayList<>(); Elements bodyElements = document.getElementsByClass("post-body"); For (Element Element: bodyElements) {// I'm using text() just to get the text, but I want to return the HTML tag directly, good, jsoup has HTML () methods. LogUtil.d("body=" + element.html()); bodyElementList.add(element); }Copy the code

3. Core code

private void loadMyBlog() { Call call; If (page == 1) {call = apistores.loadmyblog (); } else { call = apiStores.loadMyBlog(page); } call.enqueue(new RetrofitCallback() { @Override public void onSuccess(ResponseBody responseBody) { try { Document document = Jsoup.parse(new String(responseBody.bytes(), "UTF-8")); List titleElementList = new ArrayList<>(); Elements titleElements = document.getElementsByClass("post-title-link"); for (Element element : titleElements) { titleElementList.add(element); //LogUtil.d("text=" + element.text()); //LogUtil.d("href=" + element.attr("href")); } List timeElementList = new ArrayList<>(); Elements timeElements = document.getElementsByClass("post-time"); for (Element element : timeElements) { //LogUtil.d("time=" + element.getElementsByTag("time").text()); timeElementList.add(element); } //Elements categoryElements = document.getElementsByClass("post-category"); //for (Element element : categoryElements) { // LogUtil.d("category=" + element.getElementsByTag("a").text()); //} List bodyElementList = new ArrayList<>(); Elements bodyElements = document.getElementsByClass("post-body"); for (Element element : bodyElements) { LogUtil.d("body=" + element.html()); bodyElementList.add(element); } if (page == 1) { dataAdapter.clear(); } dataAdapter.addAll(titleElementList, timeElementList, bodyElementList); If (titleElementList. The size () < 8) {/ / because my blog page eight data, when less than 8 shows no page pullLoadMoreRecyclerView. SetHasMore (false); } else { pullLoadMoreRecyclerView.setHasMore(true); } } catch (Exception e) { e.printStackTrace(); } } @Override public void onFailure(int code, String msg) { toastShow(msg); } @Override public void onThrowable(Throwable t) { toastShow(t.getMessage()); } @Override public void onFinish() { pullLoadMoreRecyclerView.setPullLoadMoreCompleted(); }}); addCalls(call); }Copy the code

Jsoup parsing source code

Parsing my blog source has been uploaded to my Github, see: github.com/WuXiaolong/…

Surely so one by one analysis, you will jsoup parsing HTML, if not, give me a big red envelope privately, I teach you hand in hand, send a big red envelope, tonight I am your, hey hey.

The topic outside

You may be worried, Jsoup parsing HTML, such crawler does not infringe? Yes, I was worried too, so my app only “advertised” in my group.

bmob

Carefully, you must have found that Jsoup climb data, can only do display function, then my micro voice is not a comment function! How does this work? When I first started to make apps, personal apps could not provide POST function, but bMob solved the pain point of personal developers that there is no server. It is like a database, providing SDK, you can add, delete, change and check operations. We only need to focus on the client side, not the back end. We should know a little bit about databases so that we can take advantage of BMob. In addition to BMob, there are also leanCloud, Apicloud and other similar services. Thanks to them, personal apps can still have a chance to survive by timely solving our immediate needs.

As for how to use BMob, LeanCloud, and Apicloud, I know you’re smart enough to read their official documentation.

No artist

Artist cutting figure

In actual development, some effects can be easily done by artists making a picture. Without the cooperation of artists cutting images, app development seems to be difficult to progress, right? I actually wrote a book calledAndroid Design Support LibraryThe article mentions a sentence: “At present, the sample and Material Design style effects are available, which is quite an empty shell. You only need to plug in real data in the actual development, which is a perfect app.” Yes, Google’s Material Design style is OK, which provides a set of specifications, pictures, This is enough for our personal app, and now we have vector, which is extremely powerful. For example, the refresh button in the upper right corner of daily recommendation, as shown in the picture:



Corresponding XML:



    
Copy the code

Normally ic_loop_24dp would be an image, but I used vector as follows:

 
    
 Copy the code

Isn’t it amazing how vector is created:



This is a random demonstration of how to create a vector. To learn about vectors, refer to the doctor’sAndroid Vector has a tortuous road to compatibility”Article, write very detailed, here do not say more.

App icon

Of course the app wants to have a beautiful and meaningful icon, using Photoshop, of course I don’t know, you have to learn that. Generally, Android market requires icon sizes of 16*16, 48*48, 512*512 and rounded corners. Android development requires 48*48, 72* 72,96 * 96,144 * 144,196 *196. Therefore, when PS, you only need to make a maximum size of 512*512 and then reduce it. Photoshop steps for ICONS: 1, use photoshop to open the images you want to modify 2, on the left toolbar, select the “rounded rectangle tool” (the default is “rectangle tool”, you just need to right click on the icon can be found that the “rounded rectangle tool”), as shown above 3, in the “radius” above the box you want the input radius, general pictures selected 25, 4. Draw a rounded rectangle over the open image to cover the image. 5. Right-click the picture that has been covered and choose “Create selection”. If a window pops up, click “OK” and click “CONFIRM” in the popup option. 7. Double-click the “Background” image in the lower right layer bar (you can see the first image in the lower right corner above) and click “OK” if a window pops up. 8. Press “DELETE” on the keyboard to clear four right angles. 9. Continue to right click “Shape 1” (you can find it in the lower right corner of the screen), select “Delete Layer” from the pop-up options, and click “Yes” if a window pops up. 10. OK, you can see a rounded image. 11. Finally, click File — “Save as –” in the upper left corner and select PNG format (other formats can also be used).


Why is the icon of micro words a “word”, because I think it is simple and generous, simple, concise and comprehensive… Forget it, don’t pretend, other I can’t P!

Promotion skills

It’s a great sense of accomplishment to finish a personal app. It was launched on android market, but there were few downloads. Damn, it took a long time for labor and labor to download such a great app. ! I had to let more people know about my app. Here’s what I did:

When you download an app, you may look at the reviews of the app. If there are a lot of good reviews, will you be more willing to download it? Yes, look at my micro comments:


Ha ha ha, is not very cattle, invite comments I wrote a tool class, please accept:

public class InviteCommentUtil { private String mDateFormat = "yyyy-MM-dd"; private String mInviteCommentTime; */ public void startComment(final Activity Activity) {mInviteCommentTime = PreferenceUtils.getPreferenceString(activity, "inviteCommentTime", TimeUtil.getCurrentTime(mDateFormat)); String saveCommentTime = PreferenceUtils.getPreferenceString(activity, "saveCommentTime", TimeUtil.getCurrentTime(mDateFormat)); int compareDateValue = TimeUtil.compareDate(mInviteCommentTime, saveCommentTime, mDateFormat); if (compareDateValue == 1) { AlertDialog.Builder builder = new AlertDialog.Builder( activity); int nowReadingTotal = ReadUtil.getReadedTotal(); Builder.setmessage (html.fromhtml (" you have read "+ nowReadingTotal +"), keep up the good work! If you like me, I hope you can give me five star reviews in the app market!" )); Builder.settitle (); Builder. SetPositiveButton (" praise encouraged ", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setComment(activity); try { Intent intent = new Intent( "android.intent.action.VIEW"); intent.setData(Uri .parse("market://details? id=com.android.xiaomolongstudio.weiyan")); activity.startActivity(intent); activity.overridePendingTransition( R.anim.enter_right_to_left, R.anim.exit); } catch (Exception e) { e.printStackTrace(); } dialog.dismiss(); }}); Builder. SetNegativeButton (" next time again say ", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setComment(activity); dialog.dismiss(); }}); builder.create().show(); }} /** * Save, Prompt * again until next week/private void setComment (Activity Activity) {PreferenceUtils. SetPreferenceString (Activity, "saveCommentTime", mInviteCommentTime); <}}Copy the code

Note: the time to invite comments here is well controlled, not too frequent, or users will be disgusted.

2, focus on a market do not know if you have found, a market you clearly did not release, but can search your APP, yes, some markets will catch your app, such as Pea pod, Baidu, so strategy, focus on a market, this market is famous, but also afraid of other markets do not know? Of course, we strive for each market can be released online, one more download is a. Microspeech is in the front row of classification

Enter boutique series for many times

How to enter the front row or boutique, inviting praise is a key step.

3, new product recommendation new line, many markets have new recommendation, such as Xiaomi, girl, 360, app Treasure, generally need to self-recommendation, once recommended, download is considerable, micro must have been recommended. Oh, the updated version is a new one.

This is my good friend taught me, he really good cattle, personal APP do more cattle, let you see a link: weibo.com/p/1008082a7… “, you know how to promote on weibo, yes, it is a topic, circled with two # numbers, microblogging, is a topic, others can discuss under this topic, virtually formed a promotion role.

5, app sharing app sharing function is certainly to do, in case the user feels that your app is great, want to recommend to friends, the result does not share the function, will not rest vegetables, share micro blog can add two # circle oh.

6, QQ group if you directly send app download link in the group, there will only be a result: T. For example, most of us are technical groups. What I do is to write an article to share the technology used in my app. The article will attach the app download address, and then people who are interested in this technology may ask, so I can legitimately “promote”.

The above only I know, may not be effective, after all, I am not a professional promoter.

How to make money

Everything is ready, only the east wind, when your user number is large enough, someone will naturally find you, invest in your APP, this process early 0 income, energy and time does not count, may also have to burn money, not suitable for individual developers, I choose to earn a small amount of money, APP and advertising. Advertising platform choose a third party, the first I use au, but found that I didn’t profit for a period of time, feeling more au buckle quantity good, after trying many media, YiDeSi odd, mango aggregation easily, also used point integral, found some market keep online integral type of app, to give up, and baidu, tencent’s wide click-through mobile advertising alliance, Google also played, revenue is the most stable baidu, this is not black it.

As for the AD integration, also provide SDK, go to their official website to find out.

Recommended reading

A complete set of Android common framework Android Design Support Library using AndroidMVPSample

Contact the author

My wechat official account: Wu Xiaolong, welcome to follow and exchange ~

The last

Several of my app, I personally do very satisfied, functions are very perfect, so I think there is nothing to be updated later, plus good advertising is a period of time, mobile advertisers have to lead to advertising unit price is too low, and the android market for individual developers to various restrictions, such as not let online video app; At a certain point, a certain 60 must use their own reinforcement to enable the online app, so there is no motivation to continue to maintain the app, work or have motivation, otherwise why alive? However, I know some people still insist on doing personal APP, do well, daily income of hundreds or even thousands. The ultimate purpose of an app is to make money.

This post has been set as the essence of the post!