Showing posts with label Code Sample. Show all posts
Showing posts with label Code Sample. Show all posts

Tuesday, November 5, 2019

remote image best practices

You can check out this sample code for remote image
https://gist.github.com/MotiurRahman/57535845ebf40bd2041448991ebd92fc

Secondly, If you would like to resize image before adding it to the window then you can use httpclient the response will be a blob, for instance, this.responseData inside the onLoad callback. Sample code - https://gist.github.com/MotiurRahman/130b7f232a74956b0c26d7ddf4ac6b34

Hope this helps.

Wednesday, October 9, 2019

Monday, April 29, 2019

Social share for android

Sample code


========
 var share_body = "https://play.google.com/store/apps/details?id=motiur_bdresult.bd.com.bdresult";
        var share_subject = "Please download it from the below link";

        var intent = Ti.Android.createIntent({
            action: Ti.Android.ACTION_SEND,
            type: "text/plain"
        });

        intent.putExtra(Ti.Android.EXTRA_SUBJECT, share_subject);
        intent.putExtra(Ti.Android.EXTRA_TEXT, share_body);
        intent.addCategory(Ti.Android.CATEGORY_DEFAULT);
        Ti.Android.currentActivity.startActivity(intent);

========

Hope this help.

Tuesday, March 19, 2019

Thursday, January 24, 2019

Monday, January 14, 2019

Wednesday, April 4, 2018

Hyperloop: Example code for checking the notification is enabled or not.

After adding hyperloop module run the following sample code

////////

var Activity = require('android.app.Activity');
var activity = new Activity(Ti.Android.currentActivity);
var contextValue = activity.getApplicationContext();

var notification = require('android.support.v4.app.NotificationManagerCompat');

var notificationObject = notification.from(contextValue);


function doClick(e) {
alert(notificationObject.areNotificationsEnabled());

}

////

Thanks!

Friday, December 1, 2017

Arrow CRUD operation using custom object

Please take a look following GitHub link for ArrowDB CRUD operation

- https://gist.github.com/MotiurRahman/86a57d86fde36dcfe6044a402564b834

Hope this helps.

Sunday, July 30, 2017

CRUD operation for SQLight DataBase

Please take a look following GitHub link for SQLight database

https://gist.github.com/MotiurRahman/5ecc0f775d81defbdecf34192bf057d3

Hope this helps.

Let me know if you have any question.

Wednesday, December 14, 2016

Push notification sample code

Appcelerator provided subscribed device token code with iOS 10 or later devices have some problem.
Actually, this portion of code is not working

Ti.Platform.name == "iPhone OS"

So please take a look this sample code for push notification

Hope this helps.

Sunday, December 4, 2016

Sending push via firebase API key.


 You can import a cloud enable project into Firebase. Basically similar, the end result will be a new key is generated. The steps for this are:
  • Log into Firebase console
  • https://console.firebase.google.com
  • Go to Add project >>Add Firebase to your existing project (From the Project name)
  • Select "Project Settings" from the gear menu
  • Select the "CLOUD MESSAGING" Tab and use the server key.


Note: Make sure your Appcelerator ID and package name is same











For creating new firebase project

https://documentation.onesignal.com/docs/generate-a-google-server-api-key


(Till steps 2)

Thanks.

Wednesday, November 6, 2013

Facebook Like button show on your webSite

1. The following snippet of code will give the basic version of the SDK where the options are set to their most common defaults. You should insert it directly after the opening <body> tag on each page you want to load it:


<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'FBAPPID',
      xfbml      : true,
      version    : 'v2.8'
    });
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>
2. Add this code in your page where you want to show the like button

<div class="fb-like" data-href="https://www.facebook.com/wasam.arts" data-width="200" data-layout="standard" data-action="like" data-size="large" data-show-faces="true" data-share="true"></div>




Hope this helps.

Monday, November 4, 2013

How to add Custom font in Titanium also Bangla Support in android

This is the Easy way To add custom font  or support Bangla in your android apps in titanium.

At first create a folder named fonts in resource directory then past here your custom font. you can get it

And call this font in a font property where you want like this code.

var customFont = 'Spicy Rice'; // use the friendly-name on iOS
if(Ti.Platform.osname=='android') {
   // on Android, use the "base name" of the file (name without extension)
   customFont = 'SpicyRice-Regular';
} 

var label1 = Titanium.UI.createLabel({
   color:'#000',
   text:'I am Window 1',
   font:{
      fontSize:40,
      fontFamily: customFont
   },
   textAlign:'center',
   width:'auto'
});


You can follow this link Custom_Fonts to know more.
Thanks