rendering iscroll on android / phonegap project - android

Does anyone know of any android app which uses iscroll. I would like to test it on my device. Reason being that my current phonegap/android project does not work with iscroll4....
I will post details of the same later....but just want to see if iscroll atall works on android...I have my doubts...
Tried all the approaches of calling iscroll but simply does not work..
here is the code for requirejs:
define(['jquery','domready',
function($,domReady){
var menu_iscroll;
function loaded() {
alert("inside loaded for iscroll:dom under hmenu is");
alert($('#hmenu').html());
if ($('#hmenu').length){
alert('setting iscroll');
menu_iscroll = new iScroll('hmenu');}
};
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
domReady(function() {
alert("entered domready for creating iscroll");
loaded();
});
return menu_iscroll;
});
and here is code for main.js:
require.config({
paths:{
jquery:'vendor/jquery/jquery.min',
'jquery.mobile':'vendor/jquery.mobile-1.3.1.min',
'jquery.mobile-config':'jqm-config',
underscore:'vendor/underscore/underscore-min',
backbone:'vendor/backbone/backbone-min',
handlebars:'vendor/handlebars/handlebars',
text:'vendor/text/text',
bootstrap:'vendor/bootstrap/js/bootstrap.min',
iscroll:'vendor/iscroll/dist/iscroll-min',
domready:'vendor/domReady'
},
shim: {
'backbone': {
//These script dependencies should be loaded before loading backbone.js
deps: ['jquery','underscore'],
//Once loaded, use the global 'Backbone' as the module value.
exports: 'Backbone'
},
'underscore': {
exports: '_'
},
'handlebars' : {
exports : "Handlebars"
},
'iscroll' : {
exports : "iScroll"
},
'jquery.mobile-config': {
deps: ['jquery']
},
'jquery-mobile': {
deps:['jquery','jquery.mobile-config'],
},
},
waitSeconds:10,
});
require(['jquery','views/menuscroll','index'],function($,scrollView){
new scrollView;
});
and inside scrollview:
define(['jquery','domready','iscroll','test'],
function($,domReady,iScroll,testView){
new testView; //this is where all the rendering of the DOM occurs...
var menu_iscroll;
function loaded() {
alert("inside loaded for iscroll:dom under hmenu is");
alert($('#hmenu').html());
if ($('#hmenu').length){
alert('setting iscroll');
menu_iscroll = new iScroll('hmenu');}
};
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
domReady(function() {
alert("entered domready for creating iscroll");
loaded();
});
return menu_iscroll;
});
I am now pretty confident after debugging that with phonegap/iscroll/requirejs on android platform that the much marketed iscroll module fails to render on android....it simply does not work...

Related

Failed to query purchased items inventory (error -1003) - Appcelerator Titanium inAppBilling

I am making Android application with Appcelerator Titanium. I've added ti.inappbilling module (v. 3.0.2) and everything was working fine (I can make purchases, application is in Google Play) until I want to query inventory (what always returns an error).
I wanted to query already bought items and I did it this way:
var runSetup = function() {
myApp.inAppBilling.startSetup({
publicKey: myApp.PUBLIC_KEY //this is defined in code
});
}
var setupComplete = function(e) {
if (e.success) {
setTimeout(function() {
//i did timeout to be sure sure delay is not an issue
myApp.inAppBilling.queryInventory();
}, 5000);
} else {
alert('Payment Setup FAILED.');
}
};
myApp.inAppBilling = require('ti.inappbilling');
myApp.inAppBilling.addEventListener('queryinventorycomplete', function(e) {
Ti.API.info(JSON.stringify(e));
});
myApp.inAppBilling.addEventListener('setupcomplete', setupComplete);
runSetup();
As a resposne I always get error -1003 (IAB RESULT VERIFICATION FAILED).
Whole response looks like this:
{
"type": "queryinventorycomplete",
"source": {
"bubleParent": true,
"invocationAPIs": [],
"apiName": "Ti.Module",
"__propertiesDefined__": true,
"_events": {
"purchasecomplete": {},
"queryinventorycomplete": {},
"setupcomplete": {},
}
},
"responseCode": -1003,
"success": false,
"bubbles": false,
"cancelBubble" :false
}
I had the same problem
check if myApp.PUBLIC_KEY contain your correct key
runSetup = function() {
Ti.API.info('myApp.PUBLIC_KEY ' + myApp.PUBLIC_KEY);
myApp.inAppBilling.startSetup({
publicKey : myApp.PUBLIC_KEY //this is defined in code
});
};

Ionic admob implementation using floatinghotpot cordova-plugin-admob

I'm following this tutorial for having banner ads in my android application.
https://blog.nraboy.com/2014/06/using-admob-ionicframework/
The problem is that I get an error callback from the plugin which is only telling me :
Invalid action
I ran the cordova plugin add for the plugin, I modified the admob publisher id, I used the sample code from the tutorial right above but it always get stuck in the second callback function which is the error case callback.
Here is the code I used :
var admobApp = angular.module('myapp', ['ionic'])
.run(function($ionicPlatform, $ionicPopup) {
$ionicPlatform.ready(function() {
if(window.plugins && window.plugins.AdMob) {
var admob_key = device.platform == "Android" ? "ANDROID_PUBLISHER_KEY" : "IOS_PUBLISHER_KEY";
var admob = window.plugins.AdMob;
admob.createBannerView(
{
'publisherId': admob_key,
'adSize': admob.AD_SIZE.BANNER,
'bannerAtTop': false
},
function() {
admob.requestAd(
{ 'isTesting': false },
function() {
admob.showAd(true);
},
function() { console.log('failed to request ad'); }
);
},
function() { console.log('failed to create banner view'); }
);
}
});
});

Import sip client module to appcelerator error

I'm trying to implement SIP client call to accelerator project. After a few hours of Googling, I decided to use TISIPCLIENT .
So I imported the module to my project. But now I am facing one big problem. I keep getting the error createSipclient method not found.
Here is my code:
var sipclient = require("com.yydigital.sipclient");
var sip = sipclient.createSipclient({
// Events
onregistering : function() {
//callback
}, onregisterationfailed : function() {
//callback
}, onregistrationdone : function() {
//callback
}, oncallestablished : function() {
//callback
}, oncallended : function() {
//callback
}, onincomingcall : function(e) {
//callback
}, onringingback : function() {
//callback
}, oncallbusy : function() {
//callback
}, onerror : function(e) {
//callback
}
});
What could be the cause of the error and how do I fix it?
By seeing your error "createSipclient method not found."...
It seems like the module is not able to locate the proxy. Try to rebuild the module and use it, this will definitely solve your problem since i had faced many times the same error and i did the same to solve the issue.
Let me know if that works else we will look in other way.

Ionic/Cordova app plays sound in emulator but not on Android device

I'm new to Ionic and Cordova, so I'm sure I'm missing something basic, but my problem is a packaged APK does not play sounds on an Android device. I can get the sound to play in the Ripple emulator just fine with the following code:
.controller('MainCtrl', ['$scope', function ($scope) {
$scope.playStartBell = function () {
var media = new Media('media/startBell.mp3', function () {
console.log('good');
}, function (err) {
console.log('bad: ', err);
});
media.play();
},
$scope.playStopBell = function () {
var media = new Media('media/stopBell.mp3', function () {
console.log('good');
}, function (err) {
console.log('bad: ', err);
});
media.play();
}
}])
I've used Cordova to install the media plugin: $cordova plugin add org.apache.cordova.media
According to this SO post, a value needs to be added to the config.xml, but I'm not sure how to do it properly for Ionic/Cordova.
Turns out that you have specify path starting with the /android_asset/www prefix like so:
/android_asset/www/
So changing my code to the following worked. Note you'll want to detect what device you're running on to determine the appropriate location.
.controller('MainCtrl', ['$scope', function ($scope) {
///android_asset/www/
$scope.playStartBell = function () {
var media = new Media('/android_asset/www/media/startBell.mp3', function () {
console.log('good');
}, function (err) {
console.log('bad: ', err);
});
media.play();
},
$scope.playStopBell = function () {
var media = new Media('/android_asset/www/media/stopBell.mp3', function () {
console.log('good');
}, function (err) {
console.log('bad: ', err);
});
media.play();
}
}])

Is the below code applicable in sencha touch 2.0

Hello friends I am creating an app in sencha touch 2.0 in which i have added a search button to the toolbar.Now i want open a search field with transparent background like the below image.
While i run my project the logcat indicates me that error is in controller file.Below i am adding my controller class.
Ext.define('MyApp.controller.search',{
extend: 'Ext.app.Controller',
config: {
refs: {
groupList: "groupList"
},
control: {
groupList: {
searchField: "searchField"
}
}
},
searchField: function(){
// console.log("SearchField Tapped");
if ( ! this.searchView)
{
this.searchView = this.render({
xtype: 'searchView',
});
var cancelSearchBtn = this.searchView.query('#'+cancelSearchBtn)[0];
cancelSearchBtn.setHandler(function(){
this.searchView.hide();
}, this);
}
this.searchView.show({
type: 'slide',
direction: 'up',
duration: 500,
});
},
launch: function(){
alert('Hello search');
},
});
I am getting the following error in logcat:-
TypeError: Result of expression 'this.render' [undefined] is not a function. at
file:///android_asset/www/app/controller/SearchController.js:18
Help me to get rid of the problem.
Thanx in advance.
There is no render method inside the controller. You need to create an instance of that component and then add it to the container you want it visible in (normally called Main).

Categories

Resources