Here’s a list of steps to install lamp on a fresh server.
1 | sudo apt-get update |
Here’s a list of steps to install lamp on a fresh server.
1 | sudo apt-get update |
To do this add this line to ~/.bashrc file.1
export PATH=$PATH:~/scripts
Then all scripts in this file can be called without pathname.
To add existing programs to this list type this in the script folder.1
ln -s program
I find most examples on the web are very barebone and nothing on linkedin Oauth. So heres an example with linkedin.
1 | function Ctrl(scope, $cordovaOauth, oauthService){ |
The oauthService is calling this url
“https://api.linkedin.com/v1/people/~:(email-address,first-name,last-name)?format=json&oauth2_access_token=“ + access_token;
Hope this saves you time.
I found it very fustrating that they didn’t fix this bug yet.
When you installed the inappbrowser cordova plugin, you probably did the following:
1 | cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git |
In ngCordova.js, they hardcoded “org.apache.cordova.inappbrowser” when your plugin is called “cordova-plugin-inappbrowser”.
The solution is to strign replace all traces of “org.apache.cordova.inappbrowser” and everything should work fine.
Hope this saves you time.
After developing my mobile app on the browser, I found many issues to arise when I started testing it on android.
I’m going to list all issues I encounter here for my reference in the future. IF this can help you save hours of work then thats good too.
##Issues
1.When using $http service in angular to do a POST request, it will wrap all form data in json and send it to the server.
If your backend is PHP(Node works fine), it won’t understand the json you send ot the server. The hack I found to fix this is the following:
1 | .config(function($httpProvider){ |
2.When testing your mobile app in android, make sure to tunnel your server if your using localhost or a virtualhost hostname.
This stumped me for a while. I used ngrok to tunnel the port. If you have multiple virtualhost there maybe issues.
Maybe comment out the ones your not using.
3.When the spacing looks good in chrome, expect there to be less space in android. Try not to use position absolute stuff that are few pixels off
other elements.
4.Always use “ white-space: no-wrap;” for divs. For some reason android likes to wrap them.
5.If theres an error in the resolve function, it will crash hte page without warning. The usual cause of this kind of error is missing dependancy.
6.When using static images, make sure images are reference from “./“;
7.Local HTML5 videos don’t work properly in android. Just don’t do it. Just transform the video into gif and display it to save your sanity.
For videos that are external use the following script:1
2
3<video class="media-video" preload="auto" webkit-playsinline controls poster="./img/posterdefault.jpg">
<source type="video/mp4" ng-src="{{trustSrc(media.video)}}"></source>
</video>
I put a poster that matches the background of the page so it looks like the video just pops up and shows. Otherwise, you will see an ugly poster while it loads.
The video will always take time to load so you need the poster.
8.Make sure that each route you make has cache: false so when you navigate using href tags, it reloads the page from scratch or the page will look the way before navigating.
9.Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
This error means that you installed the apk from one machine and trying to install it with a different machine.
Delete the old app and create new one.
10.When using push notifications, make sure you add both ipv4 and ipv6 ips to google gcm.
12.What you see in browser is not how it will look in the emulator. What you see in emulator is not what you see in the device.
##Tips
1.Setting up Android environment on phone.
run
1 | ionic platform add android |
run
1 | ionic run android --device |
2.Dynamic Source for img and videos
1 | function controller(scope, $sce){ |
1 | <img ng-src="{{trustSrc(source))}}"/> |
3.Screenshoting screen in android
Hold power button and down volume to screenshot
To Implement Push notification do the following:
add “davibennun/laravel-push-notification”: “dev-master” to your composer.json file1
2
3composer update davibennun/laravel-push-notification
php artisan config:publish davibennun/laravel-push-notification
Add the following to “app/config/app.php”
1 | 'providers' => array( |
Run the following:
1 | php artisan config:publish davibennun/laravel-push-notification |
Fill in your api key and you can now use your push notification for android.
##Common errors I recieved
This directive is useful for trimming a string.
1 | function trim(){ |
Hope this helps you out.
Here’s a good directive I found that formats a date object as time ago string.
1 | function timeago() { |
Hope this helps you out.
This filter is very useful for you to escape all html from a string.
1 | function htmlToPlainText() { |
Hope this helps you out.
Here’s my situation:
Solution:
I found this awesome directive to accomplish this:
1 | function dynamic ($c) { |
So here’s how my controller and html will look like:
1 | function controller($scope){ |
1 | <div class="article-contents" dynamic="content"></div> |
Hope this helps you out.