Google Analytics & Blackberry UserAgent - blackberry

I'm using this code to get the blackberry info on google analytics
private static String getUserAgent()
{
String userAgent = "Blackberry" + DeviceInfo.getDeviceName() + "/" +
getOsVersion() + " Profile/" + System.getProperty(
"microedition.profiles" ) + " Configuration/" + System.getProperty(
"microedition.configuration" ) + " VendorID/" +
Branding.getVendorId();
return userAgent;
}
And then using it here :
conn.setRequestProperty("User-Agent", userAgent);
The problem is that it doesn't recognize the terminal like a mobile phone , but it takes difference in browser .
Browser:
Navegador Visitas % Visitas
1. Blackberry8900 36 100,00%
Any idea if google analytics have some params to know that is a mobile phone ? or if i'm using a badformated useraggent.
Thanks for your answers.

Related

Collecting card details within the app on Telr Payment gateway

I am integrating "Telr" payment gateway on my current app.I have read all docs part. My app will be collecting the card details (rather than using the hosted payment pages).This is the request i am making.If anybody has some demo or integrated Telr payment gateway, please feel free to reply.
let paramString: String = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<mobile>" +
"<store>\(12345)</store>" + "<key>somekey</key>" +
"<device>" +
"<type>\("iPhone6")</type>" +
"<id>\(deviceId)</id>" +
"<agent></agent>" +
"<accept></accept>" +
"</device>" +
"<app>" +
"<name>Telr_Payment_Demo</name>" +
"<version>1.0</version>" +
"<user>xyz.Demo</user>" +
"<id>1234567</id>" +
"</app>" +
"<tran>" +
"<test>12</test>" +
"<type>paypage</type>" +
"<class>moto</class>" +
"<cartid>syste1075</cartid>" +
"<description>this is demo on telr</description>" +
"<currency>AED</currency>" +
"<amount>\(9.80)</amount>" +
"<ref>\("000000000001")</ref>" +
"</tran>" +
"<card>" +
"<number>\("5555555555554444")</number>" +
"<expiry>" +
"<month>\(02)</month>" +
"<year>\(2018)</year>" +
"</expiry>" +
"<cvv>\(123)</cvv>" +
"</card>" +
"<billing>" +
"<name>" +
"<title>\("fsfsfs")</title>" +
"<first>\("First")</first>" +
"<last>\("last")</last>" +
"</name>\n" +
"<address>" +
"<line1>\("Kathmandu bazar")</line1>" +
"<line2>\("address 6")</line2>" +
"<line3>\("Near gausala")</line3>" +
"<city>\("kathmandu")</city>" +
"<region>\("Bagmati")</region>" +
"<country>\("Nepal")</country>" +
"<zip>\("977")</zip>" +
"</address>" +
"<email>\("s*********#gmail.com")</email>" +
"</billing>" +
"</mobile>"
I am getting following response from server
<mobile>
<webview>
<start>https://secure.innovatepayments.com/gateway/webview_start.html? code=f1caa6ce6c23595b71dc00369</start>
<close>https://secure.innovatepayments.com/gateway/webview_close.html</close>
<abort>https://secure.innovatepayments.com/gateway/webview_abort.html</abort>
<code>f1caa6ce6c23595b71dc00369</code>
</webview>
<trace>40008/1683846/595b7168dc</trace>
</mobile>
The first url will redirect to hosted payment pages card details view.I do not know what should i do with that response.This is the payment integration guidelines for developer.
From the docs you linked to say:
When a webview response is received, the App will need to direct the
customer to the URL given as the start address. The App should monitor
the progress of the webview, and once it reaches the URL provided as
the close address, it should close the web display and continue with
the transaction process.
To complete the transaction, the App must now make a second request to
the gateway. This request includes will trigger the final
authorisation stage of the transaction, and return the authorisation
response. The request must be sent to:
https://secure.innovatepayments.com/gateway/mobile_complete.xml
...
so I would start with that and see what happens

how to get youtuber video information in youtube api v3..?

i am working on a youtube based api website and want to get the complete information of a video.
i am doing this as
<?php $JSON_Data = json_decode(file_get_contents("https://gdata.youtube.com/feeds/api/videos/9Xhat18gkLw?v=2&alt=json")); ?>
and getting data using this method
channel is:<?php echo $JSON_Data->entry->author[0]->name->{'$t'}."<br>"; ?>description is:<?php echo $JSON_Data->entry->{'media$description'}->$t."<br>"; ?>published time:<?php echo $JSON_Data->entry->published->{'$t'}."<br>"; ?>duration time:<?php echo $JSON_Data->{'yt$duration'}->seconds."<br>"; ?>image link:<?php echo $JSON_Data->{'media$thumbnail'}[2]->url."<br>"; ?>title is:<?php echo $JSON_Data->entry->title->{'$t'}."<br>"; ?>
but i am successful in getting a few information like title, channel name and published time
channel is:Naatsworld
description is:
published time:2011-08-27T01:32:36.000Z
duration time:
image link:
title is:Owais Raza Qadri - Main So Jaon Ya Mustafa Kehte Kehte (Full Video Naat Album)!!!
i also want to get video duration, description and image link
please help me how to do this
See if this helps you lot :
<script type="text/javascript">
function youtubeFeedCallback(data) {
document.writeln('<img src="' + data.entry["media$group"]["media$thumbnail"][0].url + '" width="' + data.entry["media$group"]["media$thumbnail"][0].width + '" height="' + data.entry["media$group"]["media$thumbnail"][0].height + '" alt="Default Thumbnail" align="right"/>');
document.writeln('<b>Title:</b> ' + data.entry["title"].$t + '<br/>');
document.writeln('<b>Author:</b> ' + data.entry["author"][0].name.$t + '<br/>');
document.writeln('<b>Published:</b> ' + new Date(data.entry["published"].$t.substr(0, 4), data.entry["published"].$t.substr(5, 2) - 1, data.entry["published"].$t.substr(8, 2)).toLocaleDateString() + '<br/>');
document.writeln('<b>Duration:</b> ' + Math.floor(data.entry["media$group"]["yt$duration"].seconds / 60) + ':' + (data.entry["media$group"]["yt$duration"].seconds % 60) + ' (' + data.entry["media$group"]["yt$duration"].seconds + ' seconds)<br/>');
document.writeln('<b>Rating:</b> ' + new Number(data.entry["gd$rating"].average).toFixed(1) + ' out of ' + data.entry["gd$rating"].max + '; ' + data.entry["gd$rating"].numRaters + ' rating(s)' + '<br/>');
document.writeln('<b>Statistics:</b> ' + data.entry["yt$statistics"].favoriteCount + ' favorite(s); ' + data.entry["yt$statistics"].viewCount + ' view(s)' + '<br/>');
document.writeln('<br/>' + data.entry["media$group"]["media$description"].$t.replace(/\n/g, '<br/>') + '<br/>');
document.writeln('<br/>Watch on YouTube');
}
</script>
View demo

How to avoid Restart Bluetooth Printer after print?

I have developed windows mobile 6.1 application which search nearby Bluetooth devices and send files.Also I did print functionality to print document on Bluetooth printer.
First time print functionality is working perfectly fine but when I print the document again, then I need to restart the printer and then after it will print.
Is there any solution to avoid restart printer??
Below is my print code from reference of https://32feet.codeplex.com/discussions/355451
private void btPrint_Click(object sender, EventArgs e)
{
// Activate BT
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
System.Threading.Thread.Sleep(1000);
// Connect
BluetoothAddress btAddress;
btAddress = BluetoothAddress.Parse("0022583165F7");
BluetoothClient btClient = new BluetoothClient();
try
{
btClient.Connect(new BluetoothEndPoint(btAddress, BluetoothService.SerialPort));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
// Send data
string CPCLStr1 =
"! 0 200 200 210 1" + Environment.NewLine +
"ML 25" + Environment.NewLine +
"TEXT 7 0 10 20" + Environment.NewLine +
"Just" + Environment.NewLine +
"Testing" + Environment.NewLine +
"ENDML" + Environment.NewLine +
"FORM" + Environment.NewLine +
"PRINT" + Environment.NewLine;
// Convert CPCL String to byte array
byte[] CPCLbytes1 = ASCIIEncoding.ASCII.GetBytes(CPCLStr1);
NetworkStream ns = btClient.GetStream();
ns.Write(CPCLbytes1, 0, CPCLbytes1.Length);
btClient.Close();
}
Although you close the client stream, the printer seems to wait some time before it resets it's session.
Try to send a <EOF> or <EOT> byte at the end.
Acording to CPCL reference guide there is no simple reset command as with ESC/p for example ({esc}#).
Doing a device reset after every print seems an overkill.
EDIT: SDK sample for sendFile:
Byte[] cpclLabel = Encoding.Default.GetBytes("! 0 200 200 406 1\r\n" + "ON-FEED IGNORE\r\n"
+ "BOX 20 20 380 380 8\r\n"
+ "T 0 6 137 177 TEST\r\n"
+ "PRINT\r\n");
The above runs fine on my RW420 without the need to reset between prints.

Detecting memory leak in cocos2dx project for WP8

I want to locate few memory leaks in my cocos2dx application for windows phone 8. IDE is Visual studio express 2012. I saw this link for app profiling. But as written on the page, "Only the Execution option is available for Direct3D apps". I am not able to figure out the option for memory profiling as cocos2dx uses directx in windows phone. How should I detect memory leak?
You can detect the application memory usage by following code.
Add the following code in App.xaml.cs
public partial class App : Application
{
private static Timer timer = null;
public static void BeginRecording()
{
if (System.Diagnostics.Debugger.IsAttached)
{
// start a timer to report memory conditions every 2 seconds
timer = new Timer(state =>
{
// every 2 seconds do something
string report =
DateTime.Now.ToLongTimeString() + " memory conditions: " +
Environment.NewLine +
"\tApplicationCurrentMemoryUsage: " +
getExactValue(DeviceStatus.ApplicationCurrentMemoryUsage) + " MB" +
Environment.NewLine +
"\tApplicationPeakMemoryUsage: " +
getExactValue(DeviceStatus.ApplicationPeakMemoryUsage) + " MB" +
Environment.NewLine +
"\tApplicationMemoryUsageLimit: " +
getActualValue(DeviceStatus.ApplicationMemoryUsageLimit) + " MB" +
Environment.NewLine +
"\tDeviceTotalMemory: " + getActualValue(DeviceStatus.DeviceTotalMemory) + " MB" + Environment.NewLine +
"\tApplicationWorkingSetLimit: " +
getActualValue(Convert.ToInt64(DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit"))) + " MB" +
Environment.NewLine;
// write to IsoStore or debug conolse
Debug.WriteLine(report);
},
null,
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(2));
}
}
public static decimal getExactValue(long stats)
{
return Math.Round(((decimal)(stats) / (decimal)(1048576.00)), 2);
}
public static int getActualValue(long stats)
{
return ((int)Math.Ceiling(getExactValue(stats)));
}
now call the BeginRecording() function in application_launching.
this will give you the exact memory stats after every 2 seconds and you can identify the memory leaks.

painting a Long Text at LABELFIELD?

I have a long text for LabelField. But LabelField doesn't show all. I dont know how to fix it, what should I do?
I am using default labelfield.
manager
.add(new LabelField(
"IP kameranıza hemen bağlanmak için\n Ana Menüdeki \"Kameralarım\""
+ "butonuna tıklayınız. Açılan sayfadaki menüden \n\"Yeni Ekle\"yi seçip "
+ "kameranızın modelini, IP numarasını, port numarasını varsa kullanıcı adı ve şifresini "
+ "girip kayediniz. Eğer video server kullanıyorsanız \"Server Numarası\" "
+ "alanına izlemek istediğiniz kameranın numarasını(1,2,3 vb.) giriniz. "
+ "Normal bir IP kamera kullanıyorsanız \"Server Numarası\" alanını boş bırakınız. "
+ "Kamera listesinden istediğiniz kamerayı seçip menüden \"Izle\" seçeneğini "
+ "seçerek kameranızı izlemeye başlayabilirsiniz.Tam Ekran izlemek için "
+ "telefonunuzu yatay konumda tutunuz. Kameranızın PTZ özelliği varsa "
+ "ekranda görünen butonları kullanabilirsiniz.",
DrawStyle.HCENTER | USE_ALL_HEIGHT)
You want to use a TextField instead of a LabelField

Resources