'preview', EXCERPT_PREFERENCE => 'excerpt', POST_CONTENT => 'loadurl', ENABLE_WP_SUPER_CACHE => '0' ); protected $buildop = array( FACEBOOK_APP_ID => '', GOOGLE_SENDER_ID => '' ); protected $accountop = array( NOTIFICATION_TYPE_KEY => 'single' ); public function __construct(){ add_action('admin_init', array($this,'admin_init')); add_action('admin_menu', array($this, 'add_page')); add_action('admin_notices', array($this, 'my_plugin_admin_notices')); } function my_plugin_admin_notices() { global $pagenow; if ( ($pagenow == 'options-general.php' || $pagenow == 'plugins.php') && !is_plugin_active('json-rest-api/plugin.php')) { echo "

Please install and activate JSON REST API (WP API) plugin for your mobile app to work correctly.

"; } } public function installpwmobileapp() { $this->buildop[HOST_NAME] = get_bloginfo('url');; $this->buildop[APP_NAME] = get_bloginfo('name'); $this->buildop[EMAIL] = get_option('admin_email'); $this->buildop[AUTHENTICATION_KEY] = $this->getToken(64); $this->op[PWAPP_MENU] = $this->getFirstMenu(); $this->op[pw_mobile_app_settings::$androAppCss] = '#content-sidebar{ display:none; } #secondary { display:none !important; } .sidebar, .site-header, .footer-widgets { display:none; } #menu-header-menu{ display:none; }'; $this->op[pw_mobile_app_settings::$sharePreference] = 'TITLE'; $this->op[pw_mobile_app_settings::$shareSuffixText] = 'via'; $this->op[pw_mobile_app_settings::$shareSuffixLink] = 'POST'; $this->buildop[pw_mobile_app_settings::$tagTextColorKey] = "#ff808080"; $this->buildop[pw_mobile_app_settings::$tagBgColorKey] = "#E6E6E6"; $this->buildop[pw_mobile_app_settings::$feedBgColorKey] = "#FFFFFF"; $this->buildop[pw_mobile_app_settings::$feedTitleColorKey] = "#000000"; $this->buildop[pw_mobile_app_settings::$feedContentTextColorKey] = "#000000"; $this->buildop[pw_mobile_app_settings::$screenBgColorKey] = "#E6E6E6"; $this->buildop[pw_mobile_app_settings::$actionBarTitleColorKey] = "#FFFFFF"; $this->buildop[pw_mobile_app_settings::$actionBarBgColorKey] = "#F4832C"; if(!get_option($this->option_name)) { add_option($this->option_name, $this->op); } if(!get_option($this->build_option_name)) { add_option($this->build_option_name, $this->buildop); } if(!get_option($this->account_tab_key)) { add_option($this->account_tab_key, $this->accountop); } $this->doCurlRequest($this->buildop[HOST_NAME], "INSTALL", $this->buildop[EMAIL]); } public function doCurlRequest($host, $action, $email){ if(function_exists('curl_init')){ $url = $this->androAppHost."/appCreator/log.php?action=".$action."&email=".urlencode($email)."&host=".urlencode($host); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); //echo $output; } } public function deactivate() { $options = get_option($this->build_option_name); $this->doCurlRequest($options[HOST_NAME], "UNINSTALL", $options[EMAIL]); delete_option($this->option_name); delete_option($this->build_option_name); delete_option($this->account_tab_key); } // White list our options using the Settings API public function admin_init() { $this->plugin_settings_tabs[$this->option_name] = 'Configure'; register_setting($this->option_name, $this->option_name); add_settings_section( 'section_app_settings', 'Configure', array( &$this, 'options_do_page' ), $this->option_name ); $this->plugin_settings_tabs[$this->account_tab_key] = 'Account Settings'; register_setting($this->account_tab_key, $this->account_tab_key); add_settings_section( 'section_publish_settings', 'Account Settings', array( &$this, 'accounts_do_page' ), $this->account_tab_key ); $this->plugin_settings_tabs[$this->build_option_name] = 'Get Your App'; register_setting($this->build_option_name, $this->build_option_name); add_settings_section( 'section_build_settings', 'Get your App', array( &$this, 'build_options_do_page' ), $this->build_option_name ); $this->plugin_settings_tabs[$this->publish_tab_key] = 'Publish Your App'; register_setting($this->publish_tab_key, $this->build_option_name); add_settings_section( 'section_publish_settings', 'Publish Your App', array( &$this, 'publish_do_page' ), $this->publish_tab_key ); } // Add entry in the settings menu public function add_page() { add_options_page('AndroApp', 'AndroApp', 'manage_options', $this->plugin_options_key, array($this, 'plugin_options_page')); } /* * Renders our tabs in the plugin options page, * walks through the object's tabs array and prints * them one by one. Provides the heading for the * plugin_options_page method. */ function plugin_options_tabs() { $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->option_name; screen_icon(); echo ''; } /* * Plugin Options page rendering goes here, checks * for active tab and replaces key with the related * settings key. Uses the plugin_options_tabs method * to render the tabs. */ function plugin_options_page() { $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->option_name; ?>

AndroApp Settings

Steps to your android app

  1. Install JSON REST API (WP API) plugin
  2. Download this Test App on your phone
  3. Play around with settings in Configure Tab
  4. Create Google Cloud Messaging, Admob and Facebook App Account
  5. Generate the apk
  6. Test and Publish Your App
build_option_name); if(empty($options[CLIENT_ID])){ echo "

Generate your first android app by clicking here.

"; } } ?>
plugin_options_tabs(); ?>
You have two options
  1. Submit it yourself
    You need to create a new account on google play developer console and need to pay one time fee of $25. Geneerally it takes around 48 hours(after the payment) for new accounts to get approved.
  2. Leave it onto us
    We will do the tedius process of submission for you, for that will charge a convenience fee of $10 and submit your app from our account, ownership of the app can be transferred to you later at any point of time. For more details, drop an email @ contact@androapp.mobi
account_tab_key); ?>

Push Notification Settings

Google API Key: We use Google Messaging API's for push notifications, Follow instructions here to create a Google API project, enable GCM Service, and enter your API Key here(This is needed to send push notifications to you app)

" value="" />
Google Project Number: Enter your Google Project Number for the project created in above step.

Note: You need to publish new build everytime you change it

" value="" />
Notification Type: Select Push Notification Type, select notification style to handle more than one notifications.

" value="stack" />Stack (Group notification)
" value="single" />No Stacking(Each notification will be shown separately)

Facebook Share Settings

Facebook Application ID: Facebook App ID (for facebook share), Create a new app from here OR add android platform in your existing app. We will email the app settings after you generate your first build.
Leave it blank for using AndroApp Facebook App(You will not have access to insights)

Note: You need to publish new build everytime you change it

" value="" />

Monetization Settings

We are using top performing mobile ad network AdMob by Google. Please create an account on Admob and enter ad id's here.
Top Ad Unit: " value="" />
Bottom Ad Unit: " value="" />
List View Ad Unit: " value="" /> of size , show it after every posts.
Interstitial Ad Unit: " value="" /> show it after every page screens.

build_option_name); $accountOptions = get_option($this->account_tab_key); $tagTextColor = $options[pw_mobile_app_settings::$tagTextColorKey]; $tagBgColor = $options[pw_mobile_app_settings::$tagBgColorKey]; $feedBgColor = $options[pw_mobile_app_settings::$feedBgColorKey]; $feedTitleColor = $options[pw_mobile_app_settings::$feedTitleColorKey]; $feedContentTextColor = $options[pw_mobile_app_settings::$feedContentTextColorKey]; $screenBgColor = $options[pw_mobile_app_settings::$screenBgColorKey]; $actionBarTitleColor = $options[pw_mobile_app_settings::$actionBarTitleColorKey]; $actionBarBgColor = $options[pw_mobile_app_settings::$actionBarBgColorKey]; $args = array( 'posts_per_page' => 5, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => false ); $postslist = get_posts( $args ); ?>

These settings go into your mobile app and can't be changed once you publish your app in android app store. You have to publish your app again, everytime you update these settings, so carefully fill these before generating the build.

This is just approximate html preview, without menu and share icons, we recommend to generate the build and test on device after basic settings here.
Application Name: Define application name (This is the name which will appear in play store).
" value="" onChange="document.getElementById('actionBarTitle').innerHTML=this.value;"; />
Site Url: Enter Your site url (most probably you don't need to edit it).
" value="" />
Application Icon: Upload a png image of 512x512 dimension.
Theme Colors: Action Bar background color: " type="color" value="" onChange="document.getElementById('actionBar').style.background = this.value;" />
Action Bar Text color: " type="color" value="" onChange="document.getElementById('actionBarTitle').style.color = this.value;" />
Screen Background color: " type="color" value="" onChange="document.getElementById('androScreen').style.background = this.value;" />
Feed Title color: " type="color" value="" onChange="changeTextColor('androPostTitle', this.value);" />
Feed preview text color: " type="color" value="" onChange="changeTextColor('androPostContent', this.value);" />
Feed background color: " type="color" value="" onChange="changeBgColor('androFeed', this.value);" />
Category title color: " type="color" value="" onChange="changeTextColor('tagTitle', this.value);" />
Category Background color: " type="color" value="" onChange="changeBgColor('tagTitle', this.value);" />
" value="" /> " value="" /> " value="" /> " value="" /> " value="" /> " value="" /> " value="" /> " value="" />
post_content); if(!empty($firstImage)) { ?>
"; ?>
post_title;?>
post_content))), 0, 115); ?>
ID); if($category[0]){ echo $category[0]->cat_name; } ?>

Email: We will send generated apk link to this mail id.

" value="" />
By clicking on the below button you agree to our Terms & Conditions.

option_name); ?> First Download this Test App on your phone and enter in site url text box(in the test app).

You can change all the settings at runtime (without any need to create new build), until mentioned otherwise.
Select Menu: Select the menu to be used for mobile app, you may use the same menu as your website, or create a new menu specifically for mobile app.



Image Dimension: We fetch the first image from the post content and use it to show on the feeds pages(list pages like, category and home) on mobile app. Select the image dimension for the same.

" value="full" />Full Image (Fit to width)
" value="preview" />Preview (fit to width with limited height)
" value="noimage" />No Image (Image from the preview text will be visible, if any)


Preview Text Setting: Select which text to be used for preview on feeds(category and home page) in mobile app.

" value="excerpt" />Excerpt
" value="seo_meta_desc" />SEO Meta Description( install and enable Wordpress SEO plugin)
" value="none" />No Preview Text (only title will be shown)


Post Content: Select the post content type to use for your app, we suggest to select different options and test in on mobile app live.

" value="preprocessed" onChange="onPostContentTypeChange();" />Pre Processed content (shortcodes will be stripped, except caption, galley, audio, video, playlist and wp_caption)
" value="postprocessed" onChange="onPostContentTypeChange();" />Post Processed (all shortcodes will be processed, but it will not work if any shortcode needs javascript)
" value="loadurl" onChange="onPostContentTypeChange();" />Load from Url (It will open post page directly, you can modify CSS to hide some content, OR use isAndroAppRequest() method to check if it is a AndroApp Request.).
"> Modify below css for mobile app requests
Example check if it is a AndroAppRequest
if(function_exists('isAndroAppRequest') && isAndroAppRequest()){
//Code to be called for AndroApp Requests(mobile app)
}
Example to check if its not a AndroAppRequest
if(!function_exists('isAndroAppRequest') || !isAndroAppRequest()){
//Code to be called for regular requests
}


Share Text: Select the text to be used for share via WhatsApp and other share intents(excluding Facebook).

Suffix Text " value="" /> Suffix Link
Share Function Name: Custom share text, you can overwrite above share settings for few posts using this method
" value="" /> define a method in your themes functions.php file, if this function returns empty string, we will use above share settings.
function getShareText($post, $link){
	return "Share Text ". via ".$link;
}
					


Enable WP Super Cache for mobile app: If you are using WP Super Cache, you can enable it for mobile app requests as well.

You have to disable debugging option and display comments at the end option from Debug tab of WP Super Cache Settings page.
also uncheck Don’t cache pages with GET parameters. (?x=y at the end of a url) option


" value="1" />Enable


name)){ return $menu->term_id; } } return null; } function getToken($length) { $key = ''; $keys = array_merge(range(0, 9), range('a', 'z')); for ($i = 0; $i < $length; $i++) { $key .= $keys[array_rand($keys)]; } return $key; } }