Skip to content

Instantly share code, notes, and snippets.

@milon120203
milon120203 / index.js
Created January 1, 2020 17:27 — forked from MotiurRahman/index.js
Alloy Push notification Test in Android.
Ti.App.Cloud = require("ti.cloud");
Ti.App.CloudPush = require('ti.cloudpush');
Ti.App.CloudPush.enabled = true;
Ti.App.CloudPush.showTrayNotification = true;
Ti.App.CloudPush.showTrayNotificationsWhenFocused = true;
Ti.App.CloudPush.focusAppOnPush = false;
Ti.App.CloudPush.singleCallback = true;
Ti.App.CloudPush.addEventListener('callback', function(evt) {
@milon120203
milon120203 / app.js
Created January 1, 2020 17:26 — forked from MotiurRahman/app.js
Push Test
// Require the module
var CloudPush = require('ti.cloudpush');
var deviceToken = null;
// Initialize the module
CloudPush.retrieveDeviceToken({
success: deviceTokenSuccess,
error: deviceTokenError
});
@milon120203
milon120203 / app.js
Created November 14, 2019 15:32
overlay for iOS app in Titanium.Media.VideoPlayer (code from Motiur Rahman)
var vidWin = Titanium.UI.createWindow({
title : 'Video View Demo',
backgroundColor : '#fff'
});
var videoPlayer = Titanium.Media.createVideoPlayer({
top : 2,
autoplay : false,
backgroundColor : 'blue',
height : 600,
@milon120203
milon120203 / index.xml
Created October 22, 2019 18:40
setting texfield value from xml file as data property
<Alloy>
<Window layout="vertical">
<TextField top="50" id="Text1" onClick="onClick" width="80%">86.6</TextField>
</Window>
</Alloy>
@milon120203
milon120203 / index.js
Last active October 22, 2019 18:38
Textfield value property, setting textfield value from js file
function onClick() {
Ti.API.info('@@@ Setting focus');
alert($.Text1.getValue());
}
$.Text1.value = "86.6";
$.index.open();
@milon120203
milon120203 / another_geolocation_code.js
Last active December 27, 2019 21:44 — forked from aminulaust/location.js
GPS Location testing
var win = Ti.UI.createWindow({layout:'vertical'});
var label = Ti.UI.createLabel({top:30,width:'90%',height:Ti.UI.SIZE});
win.addEventListener('open',function(){
Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e){ apiInfo(JSON.stringify(e)); });
});
function apiInfo(msg) {
Titanium.UI.createAlertDialog({
title: "info",
Operating System
Name = Microsoft Windows 8.1 Pro with Media Center
Version = 6.3.9600
Architecture = 64bit
# CPUs = 4
Memory = 6298132480
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Titanium CLI
@milon120203
milon120203 / c_palindrome.cpp
Created October 5, 2018 23:29
Palindrome test in C
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include<string.h>
@milon120203
milon120203 / index.js
Created September 10, 2018 17:53 — forked from MotiurRahman/index.js
Push Notification
var Cloud = require("ti.cloud");
var deviceToken = null;
// Places your already created user id credential
if (Ti.Platform.osname === "android") {
var CloudPush = require('ti.cloudpush');
// Initialize the module
CloudPush.retrieveDeviceToken({
@milon120203
milon120203 / index.js
Created July 17, 2018 16:46
Portrait Mode Working
//controllers/index.js
function doClick(e) {
alert($.label.text);
}
$.index.open();