●補充說明--推播機制
1.不分android或ios,推播是推給系統,是GOOGLE 推給系統,先把要推播的內容給APP的SERVER,APP的SERVER會告訴GOOGLE SERVER要推給誰,GOOGLER SERVER再推給系統,再把APP叫出來
●程式說明:
.jpg)

.jpg)

.jpg)



















●程式參考(GitHub):使用Google Firebase Cloud Messaging接收推播訊息
●補充說明--推播機制
1.不分android或ios,推播是推給系統,是GOOGLE 推給系統,先把要推播的內容給APP的SERVER,APP的SERVER會告訴GOOGLE SERVER要推給誰,GOOGLER SERVER再推給系統,再把APP叫出來
●程式說明:
●程式參考(GitHub):使用Google Firebase Cloud Messaging接收推播訊息
●畫面預覽:
●程式說明:
**有時候建立好廣告後,廣告並沒有正常顯示,看logcast可以看到一段訊息:Ads:Ad fail to load : 0,出現這段訊息代表你的程式沒有問題,是因為廣告單元剛建立google server還沒有立刻提供適合的廣告,要等一段時間(時間不定)就會正常顯示
●程式參考(GitHub):Google Admob--在自己的app中增加google廣告單元
7/11
I start to look for a job this morning.
Hope I can get a job offer before I go to Japan.
Howerver, no one is responding to my job application.
7/12
I got the opportunities for interviews yesterday.
However, I am worried I can't pass the job knowledge test.
I discussed the Universal Studio Japan travel tips with my son last night.
7/13
I went to the night market near our home to shop our clothes last night.
The night market is my favorite place to shop.
There are two women's clothing store in the night market with lots of affordable and fashionable clothes.
7/14
I've got a runny nose and I was worried that I've got a cold.
After I taking medicine, I felt sleepy.
Howerver, I haven't finished our Japan itinerary.
7/15
I went to the clothing store in Xingnan Night Market again.
I wanted to exchange the pants for different color.
However, I bought a jacket and a chiffon top again and cost only 250 NTD.
7/16
I found that the USJ pass with special entry on the day I planned to USJ was sold out last night.
I had no choice but to rearrange our travel itinerary.
After buying all the e-tickets we need, I found the email I wrote was wrong and I was really nervous.
7/17
I scheduled two job interviews today.
I got the job offer after the second interview.
I was happy but worried I might not excel at this job.
7/18
There are so many things to prepare for going abroad that I worry something might be forgotten.
However, I am excited and look forward to going to Japan with my son.
This is his first time to traveling abroad.
7/19
I feel a bit nervous and excited.
Not only because I'll travel to Japan soon, but also because I decide to quit when I return to Taiwan.
I don't know if I can adapt the new job.
7/20
We'll go to Japan tomorrow and all of us are so excited.
I started to pack our suitcase this afternoon and my son felt very bored because I couldn't play with him.
When I am in Japan, I'll stop writing in my English diary.
*look for a job:找工作
*respond to one's job application:sb找工作沒有回應
*get an opportuniy for interview:取得面試機會
*the job knowledge test:專業技能測驗
*travel tips:旅遊攻略
*affordable:價格便宜/實惠的
*runny nose:一直流鼻涕
*Xingnan Night Market:興南夜市
*chiffon top:雪紡上衣
*exchange for different color:(買了衣服以後)換顏色
*have no choice but to ...:別無選擇,只能...
*e-ticket:電子票
*schedule a job interview:安排一個面試
*excel at the job/work:勝任這份工作
*not only because...but also because...:不只因為...還因為...
*adapt the new job:適應新工作
*pack one's suitcase:收拾行李
*write in a diary:寫日記
●程式說明:
*注意,在使用內建的Google Maps Activity可能會遇到下面這個問題
(出現訊息:inconvertible types; cannot cast 'android.support.v4.app.fragment' to 'com.google.android.gms.maps.SupportMapFragment' )
=>要把SupportFragmentManger轉為SupportMapFragment時,出現紅線顯示無法轉換type,這是因為在google paly-services-maps:17.0.0中,SupportMapFragmentnow 改為extends androidx.fragment.app.Fragment,而非android.support.v4.app.Fragment
=>解決辦法是把play-services-maps改為16.0.1或是把專案整合為androidX版本,這邊是直接改play service版本
●程式參考(GitHub):使用Android Studio內建Google Maps Activity建立Google Map
●程式說明 --兩個copy資料的方法,和一個讀取sqlLite的內容,最後讓使用者輸入的資料可以加入資料庫
7/1
Today is the first day of my son's swim class.
I thought he might not like the swim class. However, he enjoyed the class very much.
When I got home, my son sang the son "I miss you very bad" to me and that was so sweet.
7/2
My son started to learn to swim freestyle today.
After today's swim class, he felt tired and took a nap for more than 2 hours.
He hasn't taken a afternoon nap more than 2 hour for ages.
7/3
I had some difficulty maintaining the face detection app of our company.
However, I am ahead of schedule today.
I hope I can finish the project before I go to Japan.
7/4
My husband has been giving me the silent treatment recently.
I don't know how to make up with him and that always make me not sleep well.
I really hope I can figure out how to solve this problem.
7/5
Last night, my son woke up at 11:00 pm and then he couldn't fall asleep.
We thought he slept too long in the daytime.
Finally, I found the best way to help my son fall asleep is co-sleeping.
7/6
Again, I had difficulties in developing face recognition app of our company but our client was looking forward to receive the apk on Monday.
When I get off work, it was 1:30 am and I was too tired to eat dinner.
I could barely keep my eyes open when my son woke me up this morning.
7/7
My son and I went to eat McDonalds' after his Taekwondo class.
After eating our lunch, we helped my mom pick her new smartphone.
We visited my mom and my son kept some hair of my mom's dog as souvenir.
7/8
We tested and took lots of videos of our face recognition system for our client this morning.
After that, we attended our weekly meeting until 5:00pm.
All day long, I couldn't program.
7/9
I have started plan our Japan itinerary recently.
I thought it was easy but it took me lots of time to search the route, map, food, price and so on.
I started to worry about not being able to finish our itinerary on time.
7/10
I feel anxious and stressed as soon as my boss is in the office.
Therefore, I had stomach cramps all day long yesterday.
Everyday, I want to quit my job.
*freestyle:自由式
*for ages:很久,很長時間
*have some difficulty (in) Ving:在做..遇到困難
*be ahead of schedule:工作進度超前
*give sb. the silent treatment:和sb.冷戰
*sleep too lonag in the daytime:白天睡太多
*co-sleeping:親子同寢
*in the face of difficulty in Ving:在做...面臨困難
*can barely keep one's eyes open:幾乎睜不開眼睛
*wake sb up:把某人叫醒
*keep sth as souvenir:把sth留做紀念
*quit sb's job:離職
*have stomach cramps:胃痙攣
● 要將android studio的專案打包成sdk,分為兩種,.jar和.aar,差別在於
jar(Java Archive):是 Java 的一種檔案格式,包含class檔案與text檔案 ,不包含res中的檔案。
aar(Android Archive):除了上述的class檔案與text等檔案,還包含所有res中的檔案。
所以如果要打包的sdk只有使用class,那就直接打包jar檔案即可,但如果是有包含UI(res資源)的sdk,就要打包成aar檔案
●作法:
1.開啟要打包的專案,將build.gradle(app)中的
apply plugin: 'com.android.application' 改為 apply plugin: 'com.android.library'
將applicationId "your application id"註解掉
2.上述步驟完成後sync,再rebuild project
3.這時會產生兩個檔案,
jar檔:在app/build/intermediates/packaged-classes/debug下會有一個classes.jar
aar檔:在app/build/outputs/aar下會有一個app-debug.aar檔
這樣就完成了SDK的打包囉!!
*測試:另外開啟一個專案來測試剛剛打包的SDK是否可以正常的匯入新專案
匯入一樣分為兩種
(一)aar的匯入:
1.將打包好的aar檔放到新開專案中的app/libs下
2.在build.gradle(project)中的repositories下增加
flatDir {
dirs 'libs'
}
3.到build.gradle(app) 新增 dependency:
implementation (name:'stroke', ext:'aar')
(二)jar檔,
1.將打包好的jar檔放到新開專案中的app/libs下
2.到build.gradle(app) 新增 dependency:
implementation fileTree(include: ['*.jar'], dir: 'libs')
完成後測試StrokeTextView這個sdk是否可以正常使用,加入如下xml
(因為這邊打包的sdk有包含UI所以是採用AAR檔的方式)
測試完成畫面!!成功!!
1.開啟新的專案,選擇Empty Activity
2.設定專案名稱與位置
3.專案開啟後,選擇File=>New Module 建立一個新的Module
4.選擇Android Library=>Finish
5.設定library name
6.設定完,專案就會出現剛剛建立的library
7.進到library的目錄下,新建一個空的Class
8.在class中寫入要做為library的內容,本例中實際使用的程式內容比較多,這邊不列出
9.完成後將程式上傳至自己的github中
10.上傳後,在新建的repository中選Release=>Create a new release
11.在上方欄位輸入版本號,下方為標題=>按下Publish
12.發布完成後顯示如下畫面
13.到JitPack.io 在"Look up"欄位輸入github repository 位址(名稱)再按下"Look up"=>下方會顯示剛才在github release 設定的版本號,按下"Get it"
14.下方會出現如下畫面,把兩個gradle設定好就可以把這個library 用在別的專案
**補充說明
1.另外開啟一個專案來測試剛剛建立的library可不可以gradle,在build.gradle加入剛剛的implementation,就可以了!
2.在原本的library中也會有一個app資料夾,可以把要做sample或demo的程式放在這,使用本身的library,只要在app的build.gradle加入implementation project(':library名稱')
*Github程式參考:StrokeTextView
*參考資料:How to create your own Android Library and publish it by Anuj Gupta