Thursday, February 22, 2018

Android: does not show the Map || How to create API key for map

Usually, Map does not show if your API key is not correct or Map module version is not compatible. So the following steps can help to generate the API key

Go to the following link and "Detailed guide for users of the standard Google Maps Android API" section
You have to create your API key with the exact package name (<id> tag value) and SHA-1 certificate fingerprint. 
You can generate your SHA-1 certificate fingerprint using this command for the development App
  • keytool -list -v -keystore ~/Library/Application\ Support/Titanium/mobilesdk/osx/7.0.2.GA/android/dev_keystore
No need password, just press enter.

For production App:

You have to use production keystore file for generating SHA-1 certificate fingerprint

- keytool -list -v -keystore <here drag and drop your keystore file then press enter>



Now, use that API key in your tiapp.xml file. You can follow this doc link to do that
Hope this helps


Monday, February 19, 2018

How to play an audio and video file using hyperloop.

Here is an example code for android

var Activity = require('android.app.Activity');
var AudioManager = require('android.media.AudioManager');
var MediaPlayer = require('android.media.MediaPlayer');
var Uri = require('android.net.Uri');
var activity = new Activity(Ti.Android.currentActivity);
var context = activity.getApplicationContext();
var mMediaPlayer;

var contentUri = Uri.parse('android.resource://' + activity.getPackageName() + '/raw/abc');
//var myUri = Uri.parse("app/platform/android/res/raw/five.mp3");
//Ti.API.info("myUri=" + myUri);

mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener({
onCompletion : function(mediaPlayer) {
Ti.API.info('MediaPlayer playback completed');
}
}));
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setDataSource(context, contentUri);
mMediaPlayer.prepare();

function startMedia() {
mMediaPlayer.start();
}

function stopMedia() {
mMediaPlayer.pause();

// NOTE: You can also stop it, but then you have to prepare() it again as well
// mMediaPlayer.stop();
// mMediaPlayer.prepare();
}

$.win1.open();



Hope this helps.

Thursday, December 14, 2017

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.

Monday, October 16, 2017

How to open pdf file on Android.

Following example would be helpful for opening pdf file

////////------////////////

var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "test.pdf"); 
var outFile = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, 'tempFile.pdf'); 
var outPath = outFile.nativePath; 
file.copy(outPath); 

try{ 
Ti.Android.currentActivity.startActivity(Ti.Android.createIntent({ 
action: Ti.Android.ACTION_VIEW, 
type: 'application/pdf', 
data: outPath 
})); 
} catch(e) { 
alert('You must install a PDF reader to view this file'); 



OR


try{ 
var intent = Ti.Android.createIntent({ 
action : Ti.Android.ACTION_VIEW, 
type : "application/pdf", 
data: outPath 
}); 


var open = Ti.Android.createIntentChooser(intent, L('open_intent')); 
Ti.Android.currentActivity.startActivity(open); 
} catch(e) { 
alert('You must install a PDF reader to view this file'); 


file = null; 


Thanks

Friday, October 13, 2017

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, April 26, 2017

Setup Android SDK to the Appcelerator Studio for Mac

At first, download the Android SDK manually from the bottom of this page
Secondly, create a new folder named "android-sdk" and place downloaded tools folder inside the android-sdk folder
Now place the "android-sdk" folder to the Home directory and show the location to the Axway Appcelerator Studio>>Preferences>>Studio>>Platforms>Android>Android SDK Home
Then click on Install SDKs>> Now select android 6.X.X, 7.X.X,8.X.X and install those packages. 
If you face any issue then try to setup android SDK via the terminal.
  • appc ti config android.sdk  <SDK location>
  • appc ti setup android
  • And restart PC 
Also, take a look android SDK installation guide -
Hope this helps.