Please carefully read this guide in order to fully configure this template, and remember to test it on a Real Device – the Emulator may fail.
An internet connection is required.
IMPORTANT: The backend of this template is the DBase API.
https://mydomain.com/dbasefiles
- and replace the string of the DATABASE_PATH
variable in the DBase.java
file with your URL:
public static String DATABASE_PATH = "https://xsgames.co/__apps/grocery/";
Users.json
and Posts.json
files
This template has native Android Java/XML code so you can edit it only with Android Studio. If you don’t have it, download it for free.
Download Android Studiostring.xml
file – it’s into the res/values
folder in Android Studio – and replace the App Name of this line with your new one:
<string> string name="app_name"> Grocery </string>
com
folder as it is and rename the other ones.build.gradle
(the Module app one) in Android Studio and rename the applicationId
into your new package name, then click Sync Now on the top-right corner.
.xml
files stored into the res/layout
folder. Those files are the ones where you can edit all Views, Buttons texts, TextView’s strings, and all Views attributes – position, font color, size, etc.
.java
files.
drawable
folders, where the app icons are stored into the mipmap
folders.
tou.html
file form the left-side panel’s list in Android Studio and edit it accordingly to your own Terms of Service and Privacy Policy. Also, replace the APP_NAME
words with the new name you assigned to your App.
"mailto:support@yourdomain.com">support@yourdomain.com
tou.html
file, so you must replace support@yourdomain.com with a valid email address where people can contact you for any question, feedback or in case they want to delete their account.
ID_id value
, select that row and click the Delete Row(s) button.ID_id
value you’ve previously noted in all the other Tables of your database, check out all the rows until you’ll find that ID_id
and delete it – this happens in case it appears into some Array type columns.
ID_id
in your database:
res/values
folder in Android Studio. Open this file and keep reading this guide, you’ll have to perform some edits in this file in order to get your template ready to run.
<string> string name="app_name"> Grocery </string>
<string>name="ADMOB_INTERSTITIAL_UNIT_ID">ca-app-pub-3940256099942544/1033173712
<string>name="ADMOB_APP_ID">ca-app-pub-3940256099942544~3347511713
You have to create your Unit ID at apps.admob.comUsers.json
and Posts.json
files
#
symbol. The main color of the app and some UI will be affected by your change:
public static String MAIN_COLOR = "#fecc4c";
public static String BLACK_COLOR = "#252525";
public static String LIGHT_GREY = "#F2F3F7";
public static String TEXT_COLOR = "#6c7893";
values/colors.xml
file:
<!-- custom colors -->
<color name="main_color">#fecc4c</color>
<color name="black_color">#252525</color>
<color name="link_color">#68b9eb</color>
<color name="light_grey">#F2F3F7</color>
<color name="text_color">#6c7893</color>
public static Typeface psBold, psRegular, psItalic, psBoldItalic;
These fonts are initialized into the onCreate()
function as follows:
psRegular = Typeface.createFromAsset(getAssets(),"font/Product Sans Regular.ttf");
psBold = Typeface.createFromAsset(getAssets(),"font/Product Sans Bold.ttf");
psBoldItalic = Typeface.createFromAsset(getAssets(),"font/Product Sans Bold Italic.ttf");
psItalic = Typeface.createFromAsset(getAssets(),"font/Product Sans Italic.ttf");
In case you want to add a new font, you have to first drag your .ttf
or .otf
font file into the app/src/main/assets/font
folder.public static Typeface
line that’s into the onCreate()
function – let’s pretend you have a font file called Helvetica-Bold.ttf, you may add an instance called hBold
(it’s just an example, name it as you wish since it’s a variable):
public static Typeface popBold, popSemibold, ... hBold;
Lastly, import its path into the onCreate()
function like the existing ones. Based on the font example above, your new line of code may look like this:
hBold = Typeface.createFromAsset(getAssets(),"font/helvetica-Bold.ttf");
public static String ADMIN_EMAIL = "admin@email.com";
Test Secret
and Publishable
keys:
public static String STRIPE_SECRET_API_KEY = "sk_test_yW8n5SBQ1sdKNzp8vZSESDIA";
public static String STRIPE_PUBLISHABLE_KEY = "pk_test_sJpT9oazDpmT0Riyd7JSXcjE";
Live
key and get payments from clients: public static String MARKET_LATITUDE = "51.37178038";
public static String MARKET_LONGITUDE = "-0.46142578";
Replace the name below with your own market’s name:
public static String MARKET_NAME = "Grocery Store";
Replace the string below with the phone number of your market:
public static String MARKET_PHONE_NR = "1234567890";
Replace the string below with the currency of your prices (it must always be the 3-digit format, like EUR, GBP, etc):
public static String PRICE_CURRENCY = "USD";
Replace the string below with the estimated delivery time of goods from your market to buyers:
public static String ESTIMATED_DELIVERY_TIME = "30-35 min delivery";
Replace the number below with the cost you’ll charge to delivery products to buyers:
public static double DELIVERY_COST = 3.20;
The following array is a list of Categories. You can edit its elements as you wish, just keep the first one as it is:
public static String[] categoriesList = {
"Featured", // Mandatory, must stay in this position in order to load all 'Featured' products
// Categories
"Fruits",
"Rice",
"Meats",
"Bread",
"Pasta",
"Vegetables",
"Beverages",
"Desserts",
// You can add new Categories here...
};
The following array is a list of sorting options. leave it as it is:
public static String[] sortByList = {
"Price: Low to High",
"Price: High to Low"
};
admin
as username and qqq
as password.
admin
, otherwise the app won’t work. Don’t worry about it, nobody will be able to ever sign up using the admin
username, so your Admin account is secured.
ID_id
in the database).delivery
, you will also be able to open the buyer’s location on the Map and view his/her address. // MARK: - TABLES & COLUMNS NAMES
DATABASE_PATH
into the DBase.java
file
.apk
file of your app in your Desktop
cd
command
keytool -printcert -jarfile YourApkName.apk
[Replace YourApkName with the name of your .apk file]
_config.php
file of the DBase API in your server and paste the Server Key you just copied in this variable, then save the file:
$FCM_SERVER_KEY = '[paste the Server Key here!]';
google-services.json
file and click Next
google-services.json
file in the app folder of the Android Studio project: fireInterstitialAd;
fireInterstitialAd(ctx);
NOTE: In order to comment a line of code, just add //
in the beginning:
// fireInterstitialAd(ctx);