Documentation

Introduction

Please carefully read this guide in order to fully configure this template, and rememeber to test it on a Real Device - the Emulator may fail sometimes.

Quick Start

PLEASE DO NOT RUN THE APP as soon as you'll unzip it from your downloaded package, because you must first create a FREE account on back4app.com, then a Parse App in the main Dashboard.
After that, replace the following strings with your own Parse App's App ID and Client Key in Configurations.java:
    public static String PARSE_APP_ID =     "pwkmVrsiHTp2wN3q3UXUBiOwiE5C31atCq2CihPy"
    public static String PARSE_CLIENT_KEY = "ugVWfJTY4azulDWoXmHVnkHkidlDzw6koSzrEVha"

Your app is now connected to your own database!
You can run the app one time only via Android Studio so you'll get an alert in the Home screen. That's because there's a line of code in the Home.java file which calls a function that creates the Wallpapers class, along with some demo rows in your database.
Therefore, after getting that alert in your app at startup, stop the app and enter Home.java. Remove (or comment) this line of code into the onCreate() function:
    createWallpapersClass()

Then you can enter your own Parse Dashboard - the database - refresh it and check the brand new Stores class with its demo rows.

General

Android Studio
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 Studio


Change App Name
Enter the string.xml file - it's into the res folder in Android Studio - and replace the App name with your new one in this line:
<string> string name="app_name"> CityGo </string>


Change the Package Name
Follow these steps:

  1. In the Project panel on the left side, click on the little gear icon.
  2. Uncheck the Compact Empty Middle Packages option.


  3. Your package directory will get broken up into single directories, you will have to select each directory you want to rename and do these steps for each one:
    • Right-click on it
    • Select Refactor
    • Click Rename
    • In the Pop-up dialog, click on Rename Package - DO NOT click Rename Directory!
    • Enter a new name and click Refactor
    • Android Studio will update the changes, it may take up to 30 seconds, usually less, just wait for AS to be done.
    When renaming a com directory, Android Studio might show a warning. In this case, select Rename All.


    In case you have integrated Firebase in your project (for Firebase Cloud Messaging or other services), you must also change the "package_name" string into the google-services.json file accordingly to the new package name you've just set in Android Studio, as shown the the picture below.
    NOTE: The google-services.json file is usually located in the app folder of your project folder.


  4. Open build.gradle in Android Studio and rename the applicationId string into your new full package name, then click Sync Now on the top-right corner, it's usually highlighted by a yellow bar.
  5. Wait for build.gradle to be done. if it doens't print any error in the Android Studio console, then you've successfully renamed your package name.


  6. Reskin the app/change icons
    This project has .xml files - stored into the res/layout folder - where you can edit all Views, Buttons texts, TextView's strings and all views positions, font colors, size, etc.
    Alert messages are located in the code, they can be edited only in the .java files.


    Terms of Use and Privacy Policy
    Select the tou.html file form the assets folder 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.
    Please also pay attention to this line:
    "mailto:[email protected]">[email protected]
    

    There are a few identical lines like that in the tou.html file, so you must replace [email protected] with a valid email adress where people can contact you for any question, feedback or in case they want to delete their account.


    Google Form setup (for wallaper submissions)
    Users can submit wallpaper images through Google Form, when they tap the SUBMIT button in the Setting screen, the app opens a link in Safari. You have to first create a Google form under your own Google account - if you don't have a Google account, please create it now, it's free.
    1. Go to Google Docs and click on the + Blank form.
      Set a title for your form, and a description, here's an example:
      Wallpaper Submission Form
      We're always looking for new content to add in our app, and we would love to see and review your work! Please answer the few questions below, it'll take the time of a snap ;)
    2. Click the Settings icon and complete the GENERAL tab as it's shown below:

    3. Click the PRESENTATION tab and set it as shown below, then click SAVE:

    4. Add a Short answer field by clicking the + button and edit is as shown below:

    5. Add a File upload field by clicking the + button again, and edit is as shown below:

    6. 6. Add a Checkbox field by clicking the + button again, and edit is as shown below:

      If you click on the Preview button - the one with the eye icon - you should get something like this:

    7. You're done, now you have to click on SEND and in the Send form tab check the Shorten URL checkmark and copy the provided link:

    8. Enter Configuration.java and replace the string of the GOOGLE_FORM_LINK variable with your own Google Form's link:
          public static String GOOGLE_FORM_LINK = "https://goo.gl/forms/d1RelRwhVqEtOjA93"
      


    Check submitted Wallpapers
    You should get an email when a wallpaper has been submitted via your Google Form, anyway I suggest you to still daily check your Google Form -> RESPONSES tab, in order to see if someone has submitted some wallpaper for review and upload them in your own Parse Dashboard.
    In order to insert new Wallpapers into your own Parse Dashboard (the database), please read the Database section of this guide.

    Delete a User's account upon request
    Accordingly to GDPR Terms, you have 24 hours to delete an account after receiving a deletion request. In order for you to delete an account, you first need to identify the user's row in the User class of your Parse Dashboard, keep a note of its objectId value, select that row and click Edit -> Delete this row.
    Then, just search for that objectId value you've previously noted in all the other Classes of your database, check out all the rows until you'll find that objectId and delete it - this is in case it appears into some Array-type columns.


Configurations

The strings.xml file
You can find this file into the 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:

App Name
Replace the following name with the new one you want to give to this app in this line:
<string> string name="app_name"> CityGo </string>

AdMob Unit ID & App ID
Replace the values of these variables with your own Interstitial Unit ID and App ID strings.
    name="ADMOB_INTERSTITIAL_UNIT_ID"> ca-app-pub-3940256099942544/1033173712< /string>
    name="ADMOB_APP_ID">ca-app-pub-3940256099942544~3347511713< /string>

You have to create your Unit ID at apps.admob.com.
Follow the instructions on the AdMob's website in case you don't know how to generate an AdMob Unit ID.


The Configurations.java file
Open this file from Android Studio and keep reading this guide, you'll have to perform some edits in this file in order to get your template ready to run:

Parse Server Keys
As explained in the Quick Start section of this guide, you must replace the strings of the 2 variables below with your own App Id and Client Key that you will get from the back4app website after creating your own Parse App:
    public static String PARSE_APP_ID = "K7SCPO9S6zywk3DMoEskABkJCOOWNkwx6Lfew2hy";
    public static String PARSE_CLIENT_KEY = "kC36ZLG7UWs31cPpLUN3M8RkS6K6BK544MFYm3hD";

Custom colors
You can edit the HEX values of the following variables as you wish. The main color of the app and some other Views will be affected by your change:
    public static String MAIN_COLOR =  "#539cfd";
    public static String LIGHT_GREY = "#FFF8F8F8";
    public static String GREY = "#bababa";

PLEASE NOTE that not all views will be affected by changing the HEX values above, you may still need to go through some XML file and adjust the colors on your own with the right-side Attributes panel.

Custom fonts
This App uses some custom fonts for Buttons, TextViews ans EditTexts. The font files are stored into the app/src/main/assets/font folder and are declared in this line:
public static Typeface osBold, osSemibold, osRegular, osExtraBold, osLight, osItalic, lemonMilk;

Such fonts are initialized into the onCreate() function as follows:
	lemonMilk = Typeface.createFromAsset(getAssets(),"font/LemonMilk.otf");
	osSemibold = Typeface.createFromAsset(getAssets(),"font/OpenSans-Semibold.ttf");
    osRegular = Typeface.createFromAsset(getAssets(),"font/OpenSans-Regular.ttf");
    osExtraBold = Typeface.createFromAsset(getAssets(),"font/OpenSans-ExtraBold.ttf");
    osLight = Typeface.createFromAsset(getAssets(),"font/OpenSans-Light.ttf");
    osItalic = Typeface.createFromAsset(getAssets(),"font/OpenSans-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, then you have to instantiate it at the end of the 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 osBold, osSemibold, osRegular, osExtraBold, osLight, osItalic, 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");

List of Categories
The following array contains a list of categories for wallpapers:
public static String[] categoriesArray = {
    /* c_0 */ "Starter Pack__This pack is a great starting point to find cool wallpapers for your device.__unsplash.com",
    /* c_1 */ "Abstract__Awesome collection of abstract patterns and pictures, liquid sensations for your device.__unsplash.com",
    /* c_2 */ "Mextures Collective__This pack showcases high-def wallpapers provided by the Mextures Collective community.__mexturescollective.com",
    /* c_3 */ "Infinite Space__A fresh collection of pictures from outer space. Make your device stellar.__unsplash.com",
    /* c_4 */ "Sky Collection__A collection of sky photos.__papers.co",
    /* c_5 */ "Blurred Art__Nice variety of colored and blurred wallpapers.__papers.co",
    // ADD CATEGORIES HERE (OR EDIT THE ONES ABOVE)
};

You may notice that there's a comment on the left side of each item. That indicates the name of the image relative to the category. You may also notice the syntax of each array''s item, its has a double underscore separator: __. That's needed for the app show data.
So, in case you want to add a Category, follow this sample steps:
  1. As an example, let's pretend you want to add a new category called Awesome Art.
    You need to add a new string below the last one of the categoriesArray which must contain the name, description and website URL where you've picked the image from.
    So here's an example:
    	"Awesome Art__A brief description of this category.__unsplash.com",
    

    The website URL must not have any www, https:// or http:// prefix, it must be only the domain name!

  2. As a reminder, you may also add the /* c_6 */ before the string, so it'll look like this:
        /* c_6 */ "Awesome Art__A brief description of this category.__unsplash.com", 
    

    That /* c_6 */ comment is the name of the new image you must create and save into the drawable folder of your project's folder. Check the existing ones to see how they look like.

  3. Create a new .jpg image with Photoshop - or any other image editor software - with a size of 640x427px, name it c_6.jpg, then save it into the drawable folder:

    Now, if you run the app again, it'll show your brand new Category in the Home screen.


Support email address
You must replace the following string with a valid email adress where you want people to contact you in case of questions, support or even account deletion requests - accordingly to EU GDPR:
    public static String SUPPORT_EMAIL_ADDRESS = "[email protected]";


Parse Dashboard Classes and Utility functions
This section is a list of strings that the app calls to perform queries to the Parse Server database - aka Parse Dashboard - and it contains a few useful custom global variables and functions.
Do not edit those variables and instances unless you're an experienced Android developer, otherwise the app will not work properly.

Database

You should perform the following configurations BEFORE running the app!
The backend of this template is Parse Server hosted on back4app.com.
After performing the configurations mentioned below, you will run the app and see no content, the Intro screen will show up and you'll be able to Sign Up in order to create a test account and start testing the app.

Due to the high-performace code of this template and the FREE back4app plan's limits, you will be able to test this template for a while, but it may happen that you'll receive an email from back4app telling you that you have reached the monthly plan's limits and you should upgrade your plan.
I suggest you to do that and just subscribe for a Starter Plan - it' only $4.99/month - so you will get more Database Storage and API requests/second/month than the FREE Plan. This paid subscription will also increase the loading speed of the app and can be enough for a good amount of users using your app. Check out the pricing table here
So, follow these steps to setup your own database:
  1. Unless you already have an account on back4app.com, create one - it's FREE!
  2. Enter My Apps and click on Build new app:

  3. Type your App name and click CREATE:

  4. Wait for the website to create your app - it'll take just a few seconds - then you'll be redirected to the Dashboard (the database interface, which looks like an Excel file):

    You'll see it empty, but don't worry, it'll get data while you'll start using your template.

  5. Click on Server Settings from the left side menu:

  6. Click on SETTINGS in the Core Settings box:

  7. In the following page, you'll have to copy the App Id and Client Key, and replace the strings into Configurations.java - as mentioned already in the Quick Start section of this guide:

        public static String PARSE_APP_ID = "pwkmVrsiHTp2wN3q3UXUBiOwiE5C31atCq2CihPy"
        public static String PARSE_CLIENT_KEY = "ugVWfJTY4azulDWoXmHVnkHkidlDzw6koSzrEVha"
    


  8. Good job, your app is now connected to your own database and you can finally run and test it.

    As explained in the Quick Start section of this guide, you should shortly get an alert after running the app for the first time that warns you that the Wallpapers class have been created.

    Enter the awesome Parse Dashboard and check your database out.

    PLEASE NOTE: If you already bought the iOS verison of this template, you don't need to create a new Parse App, nor upload the main.js file in the Cloud Code section.
    Just add the App ID and Client Key strings into Configurations.java and you'll be fine.
    The power of Parse Server is that you do not have to manually create tables and columns in the database - like you would have to do in MySQL - because the SDK will automatically create Classes and columns in your Parse Dashboard while using the template!

ADD WALLPAPERS IN YOUR DATABASE

Follow these easy steps to add wallpapers rows in your Parse Dashboard and make them visible in the app:

  1. Click + A>dd row

  2. Double-click into the cell of the category column and type a category name and hit Enter - it must perfectly match one of the names in your categoriesArray in the Configurations.java file:

  3. Double-click in the cell of the phone column, click the Upload file button and select the jpg image of your wallpaper. The suggested size of the image is no more than 1242x2208px, High quality settings (in Photoshop):

  4. Double-click in the cell of the likes column and type 0:

  5. Double-click in the cell of the likedBy column and type []:

  6. Double-click in the cell of the comments column and type 0:

  7. Double-click in the cell of the isOfTheDay column and select either False if you don't want to set this wallpaper as Wallpaper of the day, or True if you want it to be shown as Wallpaper of the day in the Home screen:

    PLEASE NOTE that you can set ONLY ONE WALLPAPER as Wallpaper of the day!
    So, each day, you should enter your Parse Dashboard and select a wallpaper's row, switch its isOfTheDay cell into True and switch the old wallpaper's row into False, in order to offer a different wallpaper each day.
Done. repeat the steps above to add new wallpapers.

Due to the structure of the database, it's not possible to make any bulk upload.

Facebook login

  1. Enter your Facebook Developer page at https://developers.facebook.com/apps/
  2. Click + Add a New App

  3. Type the name of your app and your contact email address in the popup window that just showed up.

  4. Click the Create App ID button and pass the Security check that Facebook will promt out.
    After that, the browser will show your Apps Dashboard.

  5. Click on Settings -> Basic in the left-side menu.
  6. In the Privacy Policy URL type your website's URL.
    If you don't have any Privacy policy page loaded in your own server or website, don't worry about it, you may either create one and upload it to a free hosting server like 000webhost.com or just place any URL, even "http://example.com/", is ok, Facebook staff doesn't make ay check for it yet. of course it would be good to create and upload a Privacy Policy HTML or PHP page someday in your own server and change that URL with the one of your page :)
  7. Select a Category, upload a 1024x1024px or 512x512px app icon image and click Save Changes on the bottom of the page.
    Ignore the Business Use and Data Protection Officer Contact Information sections in case you're not doing any business in Europe (this is intended for companies, not indiviual developers or people).

  8. Scoll down and click + Add Platform, then select Android:

  9. Copy the package name you have set before in Android Studio and paste it in the Google Play Package Name box of the Android section.
    Type Intro in the Class Name box.
    Go back to Android Studio and run your app. You have to be logged out the app in order to enter the Intro screen and check your Logcat. You should see a message like this:
        I/log-: HASH KEY TO COPY: U05jRHlAyYvJZCAuPfKI+/l6fzQ=
    

    You have to copy only the U05jRHlAyYvJZCAuPfKI+/l6fzQ= part and paste it into the Key Hashes box.
    Lastly, switch Single Sign On option to Yes and click the Save Changes button on the bottom of the page.

  10. Click the OFF switch on the top-right corner of the page.
    Click the Confirm button in the alert that shows up - you can ignore its message, the Facebook Login will still work in your template:

  11. Now go back to your App Dashboard on back4app, scroll down and click SETTINGS in the Facebook Login box:

  12. Paste your Facebook App ID in the text box and click the + button to add it to your Parse App.

  13. Enter the strings.xml file in Android Studio - it's inside the res/values fodler - and replace the facebook_app_id value with your own Facebook App ID - you can copy it by clicking on the APP ID on the top of the screen:

    Into strings.xml:
    <string name="facebook_app_id">228126361127891</string>    
    


  14. Great, you're done with the Facebook Login settings!
PLEASE NOTE that if you already bought the iOS verison of this template, you don't need to create a new Facebook app.
Just add the Android platform to your existing Facebook App, perform the settings explained above and copy the same APP ID.

Useful stuff

F.A.Q.

Parse Server hosted on back4app
Parse Server is a powerful JSON backend based on Node.js, and its hosted on back4app.com.
Click here to learn more about this backend

Can I host Parse Server on my own server?
Yes you can, but I do not provide support for it, because it's hard to get Push Notifications and Cloud Code jobs done, that's why my templates use back4app.
You should refer to the official Parse Server Guide at parseplatform.org

What kind of support is offered?
Free support is offered in case of bugs encountered in the original template, either in the code or the UI design.
In case you have edited the code - and so created bugs because of your editing - I may apply some fee to fix your bugs by a remote connection through TeamViewer, or by you sending me your source code for verification.

Should I use Android Studio to edit this template?
yes, you must always use the latest stable officlal version of Android Studio to edit this application.
Download the latest version here: Download Android Studio

I've performed all configurations mentioned in this Guide, but something is wrong. What should I do?
• Double check all your configurations, probably you have missed something.
• Always check the Logcat in Android Studio if the app crashes, ususally the error messages are shown in red color.
The Logcat helps debugging your app, it's really important


How do I remove AdMob ads?
It's super easy, just open the Find in Path tool in Android Studio by clicking Edit -> Find -> Find in Path, and search for:
showAdMobInterstitial

The Find in Path window will show you a list of files where that string is located.
Just comment out (or delete) the following line of code in each file and the app will not show AdMob ads on next run:
showAdMobInterstitial(ctx);



Support | Requests