[{"id":"112","type":"post","status":"publish","author":"Ageelg.mobile","title":"Ramadan 2014 Meeting ","thumbnail":"http:\/\/mo7ib.info\/blog\/wp-content\/uploads\/","content":"\"tempFileForShare\"<\/a>\r\n\r\nutilize a sliding menu (see pic) for secondary navigation\r\n\r\n- Swift\u00a0talk, the team talked about their first impression with Swift WWDC in swift\r\n\r\n- M Mohsin has a customer for a marketing app and had to give app referenced for the group off the top of his head.\r\n\r\nWe need to build an app portfolio on the blog or some central place where its easy for group members or anyone from the outside to have a look at our catalog.\r\n\r\n- M Mohsin and Zhuair talked about their experience with Facebook ads and recommended us to utilize its targeted Ads to market our apps and sites.\r\n\r\n- M Mohsin\u00a0had a few things to say about app security and Open SSL but I wasn't paying attention ;P\r\n\r\n \r\n\r\nThat was a summary by me , I hope the group members can add their thoughts as well.\r\n\r\nSee you at the next meeting.","excerpt":"","date":"2014-07-23 00:12:26","gallery":[],"youtube":"","categories":[{"category0":"Uncategorized"},{"category1":"English"}],"comment_count":"0","comments":[]},{"id":"40","type":"post","status":"publish","author":"triple.m.2002@gmail.com","title":"[Android] - Lessons Learned During Development of Awwamiya Guide","thumbnail":"","content":"\r\n\r\nI hope this will tease you enough to vote for your favourites, and will give it my best to present the topic to in a practical and informative manner\r\n\r\nLet us know what you think of this experience in the comments\r\n\r\n[poll id=\"2\"]","excerpt":"","date":"2014-07-15 23:54:26","gallery":[],"youtube":"","categories":[{"category0":"English"},{"category1":"android"},{"category2":"Tutorials"},{"category3":"best practices"},{"category4":"pll_53ab1b89eb842"}],"comment_count":"0","comments":[]},{"id":"106","type":"post","status":"publish","author":"triple.m.2002@gmail.com","title":"\u062f\u0631\u0648\u0633 \u0645\u0633\u062a\u0641\u0627\u062f\u0629 \u0623\u062b\u0646\u0627\u0621 \u0625\u0639\u062f\u0627\u062f \u062a\u0637\u0628\u064a\u0642 \u062f\u0644\u064a\u0644 \u0627\u0644\u0639\u0648\u0627\u0645\u064a\u0629","thumbnail":"","content":"\r\n\r\nI hope this will tease you enough to vote for your favourites, and will give it my best to present the topic to in a practical and informative manner\r\n\r\nLet us know what you think of this experience in the comments\r\n\r\n[poll id=\"2\"]","excerpt":"","date":"2014-07-15 23:54:25","gallery":[],"youtube":"","categories":[{"category0":"\u0627\u0644\u0639\u0631\u0628\u064a\u0629"},{"category1":"\u062f\u0631\u0648\u0633"},{"category2":"pll_53ab1b89eb842"}],"comment_count":"0","comments":[]},{"id":"19","type":"post","status":"publish","author":"triple.m.2002@gmail.com","title":"\u0628\u0633\u0645 \u0627\u0644\u0644\u0647 \u0646\u0628\u062f\u0623 .. (\u0627\u0641\u062a\u062a\u0627\u062d\u064a\u0629)","thumbnail":"","content":,"excerpt":"","date":"2014-07-01 07:00:40","gallery":[],"youtube":"","categories":[{"category0":"English"},{"category1":"\u0627\u0644\u0639\u0631\u0628\u064a\u0629"},{"category2":"\u063a\u064a\u0631 \u0645\u0635\u0646\u0641"},{"category3":"pll_5371ca2127123"}],"comment_count":"0","comments":[]},{"id":"17","type":"post","status":"publish","author":"triple.m.2002@gmail.com","title":"Opening Post..","thumbnail":"","content":"t is only natural and expected that the first blog entry would welcome you all and introduce me. However, I am going to make this short and hopefully concise.\r\n\r\nMy name is Moayad Abdulhadi Al-Jishi<\/strong>, from Qatif-Saudi Arabia. I started this blog to share lessons and thoughts about technology in general, programming and multimedia in particular. Some of the posts could be about my personal analysis or feeling about some of tech news. It will not be a tech news site that just reports updated in the tech industry. Hopefully, I will not be the only one writing posts for this blog, and I wish to maintain a monthly post at least.\r\n\r\nI hope to make this blog a place that will add unique knowledge for its visitor; A place to present technical criterion and share lessons-learned by writers in both Arabic and English. I strongly believe that the Arabic content is really scarce in this field, and in need to produce new content as well as translate and re-write useful ones, with respect to the source.\r\n\r\nTo get to know the participating writers, click here<\/a>\r\n\r\nIf wish to participate in the blog, or want to suggest a topic. Please, send us a message through the contact form<\/a>","excerpt":"","date":"2014-07-01 07:00:05","gallery":[],"youtube":"","categories":[{"category0":"Uncategorized"},{"category1":"English"},{"category2":"pll_5371ca2127123"}],"comment_count":"0","comments":[]},{"id":"50","type":"post","status":"publish","author":"Ageelg.mobile","title":"Persistent Ad Area","thumbnail":"http:\/\/mo7ib.info\/blog\/wp-content\/uploads\/","content":"p style=\"text-align: center\"><\/p>\n\nHere is a\u00a0solution to having your ad area persistent throughout your app and not have to destroy->create new->get new request \u00a0on each activity navigation. Instead the navigation is done by transforming your activity into a fragment and then cycling through the fragments much like a view pager without effecting the bottom Ad area.\n\nThe key is to auto generate your view (fragment) and use below statement to cycle through the fragments.\n\ngetSupportFragmentManager().beginTransaction().replace(R.id.frame_container, new XFragment(),\"XFragmentTag\").commit();\n\nTip:\u00a0<\/span><\/strong>When dealing with dynamic fragments , I recommend you tag your fragments to make it easy to reference your fragments through the Fragment manager.<\/span>\n\n

Get the Git<\/a><\/p>","excerpt":"","date":"2014-06-12 18:48:57","gallery":[],"youtube":"","categories":[{"category0":"English"},{"category1":"android"},{"category2":"Tutorials"}],"comment_count":"0","comments":[]},{"id":"47","type":"post","status":"publish","author":"Ageelg.mobile","title":"How to load HTML with pictures into a TextView","thumbnail":"http:\/\/mo7ib.info\/blog\/wp-content\/uploads\/","content":"nbsp;\r\n\r\nHere is an Example of how to transform\u00a0your TextView into a pseudo WebView.\r\n\r\nThe concept is based on implementing the\u00a0android.text.Html.ImageGetter \u00a0class \u00a0and implementing the getDrawable() method which goes through your html source to get the pictures from the their \u00a0URLs.<\/em>\r\n\r\n \r\n

Get the Git<\/a><\/p>","excerpt":"","date":"2014-06-12 18:31:20","gallery":[],"youtube":"","categories":[{"category0":"Uncategorized"},{"category1":"English"}],"comment_count":"0","comments":[]},{"id":"23","type":"post","status":"publish","author":"Ageelg.mobile","title":"[Android] - Tadawul Data : How to use Push Notifications to update your data","thumbnail":"","content":"\"mobile\"<\/a> Tadawul.com mobile version[\/caption]\r\n\r\n \r\n

Mobile Stock\u00a0App (do more with\u00a0less)<\/strong><\/h3>\r\nIn a stock mobile application its very important to utilize the screen\u00a0real estate\u00a0and keep the data fresh, both are missing in the official Tadawul mobile website as it only shows a static web page with little information. A mobile user would have to make multiple \"clicks\" to get to see the data specific to his stock and there is no market overview similar to its big brother. Furthermore to refresh the data, the user has to refresh the page which might not fall within the 5 minute update period and would just cost the user bandwidth, which is another very important factor. An alternate way is to force your mobile browser to view the desktop version but that might be expensive to your data plan.\r\n\r\n \r\n

Pull Vs Push\u00a0<\/strong><\/h3>\r\nTo get the data there are two\u00a0approaches , getting data by pull requests\u00a0(though alarms or service) and second option is by push requests. Below are the main points to consider,\r\n\r\n\r\n\r\n\r\n\r\n
Factor<\/strong><\/td>\r\nPull<\/strong><\/td>\r\nPush<\/strong><\/td>\r\n<\/tr>\r\n
Battery\/<\/strong>Performance\/Bandwidth<\/strong><\/td>\r\nNot Optimal<\/strong><\/span> , unnecessary requests even if there is no data updated. Will cost CPU cycles, network bandwidth and battery.<\/td>\r\nOptimal <\/strong><\/span>, only issues request when the data has been updated. Saving CPU, network and battery<\/td>\r\n<\/tr>\r\n
Backend<\/strong><\/td>\r\nDoesn't\u00a0need push notification service<\/span>\u00a0<\/strong>which might add to the cost of running and maintaining your application<\/td>\r\nNeed to provide push notification service<\/strong><\/span> which might add to the cost of running and maintaining\u00a0your application<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nFor my application , I went through both methods and I ended up using push. Setting alarms was tricky , you have to consider market operation hours and also the devices clock and timezone. I got it working somewhat\u00a0however not all devices were in sync. Keeping devices in sync is a major requirement for my secret future project ;P\r\n\r\nPush wasn't a walk in the park either, at that time the Google service was called C2DM (Cloud to Device Messaging) and it took me a while to understand and get it setup, thankfully the new version of it GCM (Google Cloud Messaging) is a lot more friendly and easier to use.\r\n\r\n \r\n

Setting up GCM<\/strong><\/h3>\r\nFirst<\/strong> you need to add the required Google Play library, to do this there are two ways:\r\n
    \r\n\t
  1. [This is for Eclipse, check the below reference link for Android Studio] You need to copy the Google Play Library folder to your work space and add it as a library in your project. You then need to add the below code to your mainfest\r\n
    <meta-data android:name=\"com.google.android.gms.version\"\r\n           android:value=\"@integer\/google_play_services_version\" \/><\/pre>\r\n<\/li>\r\n\t
  2. Or you can do it the dirty way (which is what I do), copy the gcm.jar from the Android SDK folder to your project's \"libs\" folder [create it if required].<\/li>\r\n<\/ol>\r\nSecondly<\/strong> we need to add the permissions\/GCM reciver\/GCM service to your mainfest\r\n
    <manifest package=\"mypackage\" ...>\r\n\r\n    <uses-sdk android:minSdkVersion=\"8\" android:targetSdkVersion=\"17\"\/>\r\n    <uses-permission android:name=\"android.permission.INTERNET\" \/>\r\n    <uses-permission android:name=\"android.permission.GET_ACCOUNTS\" \/>\r\n    <uses-permission android:name=\"android.permission.WAKE_LOCK\" \/>\r\n    <uses-permission android:name=\"com.google.android.c2dm.permission.RECEIVE\" \/>\r\n\r\n    <permission android:name=\"mypackage.permission.C2D_MESSAGE\"\r\n        android:protectionLevel=\"signature\" \/>\r\n    <uses-permission android:name=\"mypackage.permission.C2D_MESSAGE\" \/>\r\n\r\n    <application ...>\r\n        <receiver\r\n            android:name=\".GcmBroadcastReceiver\"\r\n            android:permission=\"com.google.android.c2dm.permission.SEND\" >\r\n            <intent-filter>\r\n                <action android:name=\"com.google.android.c2dm.intent.RECEIVE\" \/>\r\n                <category android:name=\"mypackage\" \/>\r\n            <\/intent-filter>\r\n        <\/receiver>\r\n        <service android:name=\".GcmIntentService\" \/>\r\n    <\/application>\r\n\r\n<\/manifest><\/pre>\r\nThird<\/strong> step\u00a0is to extend\u00a0GCMBaseIntentService [ in our example GcmIntentService.java ] and implement your code for handling registration\/unregistered events where you can also include callbacks to your backend to update or delete registration Ids. Another important method here is the onMessage event, where you can show a push notification message or as is the case in my application trigger the application to request data updates from the backend.\r\n
    public class GCMIntentService extends GCMBaseIntentService{\r\n \r\npublic GCMIntentService() {\r\nsuper(wpConstants.gcm_projectID);\r\n}\r\n \r\nprivate static final String TAG = \"===GCMIntentService===\";\r\n  \r\n@Override\r\nprotected void onRegistered(Context arg0, String registrationId) {\r\nLog.i(TAG, \"Device registered: regId = \" + registrationId);\r\n}\r\n\r\n@Override\r\nprotected void onUnregistered(Context arg0, String arg1) {\r\nLog.i(TAG, \"unregistered = \"+arg1);\r\n}\r\n \r\n@Override\r\nprotected void onMessage(Context arg0, Intent intent) {\r\nLog.i(TAG, \"new message= \");\r\n}\r\n \r\n@Override\r\nprotected void onError(Context arg0, String errorId) {\r\nLog.i(TAG, \"Received error: \" + errorId);\r\n}\r\n \r\n@Override\r\nprotected boolean onRecoverableError(Context context, String errorId) {\r\nreturn super.onRecoverableError(context, errorId);\r\n}\r\n}<\/pre>\r\nNow that everything is setup<\/strong> , we just need to use GCMRegistrar to register the device and get a registration ID that we can store in our backend.\r\n\r\nPlease note that we need to do the registration in an AsyncTask to avoid the NetworkOnMainThreadException<\/span>\u00a0exception,\u00a0preferably we should do it alongside our data loading service\/task.\r\n
    GCMRegistrar.checkDevice(ctx); \/\/ctx is a reference to the Context\r\nGCMRegistrar.checkManifest(ctx);\r\n\/\/GCMRegistrar.unregister(ctx); \/\/just in case , note that you can preregister, i.e if the user doesn't want push notifications for example.  \r\nfinal String regId = GCMRegistrar.getRegistrationId(ctx);\r\nLog.i(this.toString(), \"registration id =====  \"+regId);\r\nif (regId.equals(\"\")) {\r\n\t\tGCMRegistrar.register(ctx,myConstants.gcm_projectID ); \/\/ gcm_projectID is the project from Google API console \r\n}<\/pre>\r\nOhhh I didnt show you how to get a GCM project ID<\/strong> ?!! , well thats easy. Head over to (Google API Console<\/a>) and register a new project. The generated Project ID is your GCM_ProjectID however to get it working you will need to \u00a01) activate GCM for your project and 2) get the web API KEY that we will use to trigger push notifications from our PHP backend.\r\n\r\nReference (developer.android.com<\/a>)\r\n

    Sending a Push Notification<\/strong><\/h3>\r\nTo trigger a push notification from the PHP backend , we need to implement the below code and have our Registration IDs and API Key ready.\r\n
    <?php\r\n\r\n$registrationIDs =  array(\"xyz\");  \/\/ fill this array with your registration IDs \r\n\r\n\/\/ send update\r\n$apiKey = \"xyz\";    \/\/replayc with the WEB API we got from Google API Console->myProject->AP IS & AUTH->Credentials->Key for browser applications->API Key  \r\n\r\n\/\/ We need to split the array in batches of 1000s , the limit for one CURL call is 1000 push notifications. You can also try curl_multi functions to start all your \r\n\/\/ pushes at once\r\n$batches = sizeof($msgRegister_ids) \/ 1000;\r\n\r\n$i = 0;\r\nwhile ($i <= $batches) {      \r\n    $registrationIDs = array_slice($msgRegister_ids, $i*1000, 1000);\r\n    $i++; \r\n  \/\/ Message to be sent\r\n$message = \"\u064a\u0627\u0645\u062a\u0639\u0644\u0645\u064a\u0646 \u064a\u0627\u0628\u062a\u0648\u0639 \u0627\u0644\u0645\u062f\u0627\u0631\u0633\";                 \/\/ you can also use post parameters and retrieve the values by doing $_GET['message']; \r\n$title = \"\u0627\u0644\u0639\u0646\u0648\u0627\u0646\";                                    \/\/$_GET['title']; \r\n$costumefield1 = \"2\";                                   \/\/$_GET['costume']; \/\/ costume fields too\r\n\r\n\/\/ Set GCM POST variables\r\n$url = 'https:\/\/android.googleapis.com\/gcm\/send';\r\n$fields = array(\r\n                'registration_ids'  => $registrationIDs,\r\n                'collapse_key' => $message, \r\n                'data'              => array( \"message\" => $message,\"title\" => $title,\"costumefield1\" => $costumefield1 ),\r\n          \/\/    'delay_while_idle' => 1, \/\/true,\r\n          \/\/    'collapse_key' => $message,\r\n                );\r\n\r\n$headers = array( \r\n                    'Authorization: key=' . $apiKey,\r\n                    'Content-Type: application\/json'\r\n                );\r\n\r\n\/\/ Open connection\r\n$ch = curl_init();\r\n\r\n\/\/ Set the url, number of POST vars, POST data\r\ncurl_setopt( $ch, CURLOPT_URL, $url );\r\n\r\ncurl_setopt( $ch, CURLOPT_POST, true );\r\ncurl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);\r\ncurl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );\r\n\r\ncurl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) );\r\n\r\n\/\/ Execute post\r\n$result = curl_exec($ch);\r\n\r\n\/\/ Close connection\r\ncurl_close($ch);\r\n\r\n$obj = json_decode($result);\r\n$return = $obj->{'failure'};\r\n \r\n}\r\n\r\n?>\r\n<\/pre>\r\n \r\n

    \u00a0Coming Soonish....<\/h3>\r\nThis article has grown too big, so I will have to break it up to\u00a0separate articles.\r\n\r\nFor example we need to create and maintain the backend , we need to prepare a Data Observer to trigger live data updates in our app and maybe a GCM lessons learned article :D","excerpt":"","date":"2014-05-15 22:45:55","gallery":[],"youtube":"","categories":[{"category0":"English"},{"category1":"post-format-image"},{"category2":"android"},{"category3":"push notification"},{"category4":"Tutorials"}],"comment_count":"0","comments":[]}]