- Create a daemon configuration script under /etc/init ( NOT /etc/init.d ):-
nano /etc/init/mybot.conf
code sample:
description "MyBot Daemon"
author "alhazmy13"
start on startup
stop on shutdown
| #!/usr/bin/env bash | |
| # I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
| # well, so I wrote my own script to do the simple job of converting package names. | |
| # | |
| # You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
| # | |
| # It'll run faster on a clean build because then there are fewer files to scan over. | |
| # | |
| # Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |
| /** | |
| * Created by Alhazmy13 on 11/6/16. | |
| */ | |
| public class LocalUtility { | |
| private static final String SAVED_LANG = "LOCALE_SAVED_LANG"; | |
| public static void onCreate(Context context) { | |
| String lang = getSavedData(context, Locale.getDefault().getLanguage()); | |
| setLocale(context, lang); |
nano /etc/init/mybot.conf
code sample:
description "MyBot Daemon"
author "alhazmy13"
start on startup
stop on shutdown
| 1. create assets folder in src under your app name. | |
| 2. In this assets folder keep your pdf files e.g. file.pdf. | |
| 3 now come your activity i.e MainActivity.java | |
| 4. setListener on any UI component what you want i.e (Button,ImageView,ImageButton); | |
| 5. In this listener call one user defined method i.e. openPDFFiles("file.pdf"); | |
| the openPDFFiles() method have below code:—- | |
| private void openPDFFiles(String fileName) //fileName is the pdf file name which is keep in assets folder. ex file.pdf | |
| { |
| Enabling communication with API if server has Self-Signed Certificate |
| public class AccountAuthenticator extends AbstractAccountAuthenticator { | |
| private final Context context; | |
| @Inject @ClientId String clientId; | |
| @Inject @ClientSecret String clientSecret; | |
| @Inject ApiService apiService; | |
| public AccountAuthenticator(Context context) { | |
| super(context); |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)