Smartface 4.5 Location info - smartface.io

Following code gives compile error in order to get location info from gps for smartface 4.5 for android and ios.
How to get loctaion with SMF 4.5?
// Get location
* #this SMF.Net.Eventsfunction Global_Events_OnLocationChanged(e){
alert(e.lat);
alert(e.lng);
}

You should set GPS status as true before Global_Events_OnLocationChanged event.
Device.setGPSStatus(true);
* #this SMF.Net.Events
*/
function Global_Events_OnLocationChanged(e){
alert("myLat : " + e.lat);
alert("myLng :" + e.lng);
}

Related

Unable to get token using huawei_push

I have followed the steps in documentation to configure the huawei_push package in plugin.
I want to integrate push notification. I am getting error when i use this code
void _onTokenEvent(String event) {
token = event;
if (token != null) {
print("TokenEvent: " + token!);
}
}
void _onTokenError(PlatformException error) {
print("TokenErrorEvent: " + error.toString());
}
static Future<void> getToken() async {
try {
Push.enableLogger();
await Push.getToken("");
print('Huawei push token :: ${HosNotificationHelper.token} ');
Push.disableLogger();
} catch (e) {
print(e.toString());
print('THISIS EXCEPTION');
}
}
and error is below
I/HMSSDK_c(31657): The local secret is already in separate file mode.
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_HMSBIInitializer(31657): Builder->biInitFlag :false
2
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_HuaweiApi(31657): inner hms is empty,hms pkg name is com.huawei.hwid
I/HMSSDK_HuaweiApiManager(31657): sendRequest
I/HMSSDK_BaseHmsClient(31657): ====== HMSSDK version: 50300304 ======
I/HMSSDK_BaseHmsClient(31657): Enter connect, Connection Status: 1
I/HMSSDK_BaseHmsClient(31657): connect minVersion:30000000 packageName:com.huawei.hwid
I/HMSSDK_Util(31657): available exist: true
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_AvailableAdapter(31657): HMS is not installed
I/HMSSDK_BaseHmsClient(31657): check available result: 1
I/HMSSDK_BaseHmsClient(31657): bindCoreService3.0 fail, start resolution now.
Please help
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_AvailableAdapter(31657): HMS is not installed
This error indicates that the HMS Core is not installed on this device.
Therefore, you are advised to search for the HMS Core in the AppStore of the phone, install it, and try again.

I keep getting this error on Slim 4 after installing new version 4.12

I keep getting this error Slim Application Error after installing the new Slim 4 framework.
I tried switching back to old version of slim but I keep getting the same thing.
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
/**
* Instantiate App
*
* In order for the factory to work you need to ensure you have installed
* a supported PSR-7 implementation of your choice e.g.: Slim PSR-7 and a supported
* ServerRequest creator (included with Slim PSR-7)
*/
$app = AppFactory::create();
// Add Routing Middleware
$app->addRoutingMiddleware();
/*
* Add Error Handling Middleware
*
* #param bool $displayErrorDetails -> Should be set to false in production
* #param bool $logErrors -> Parameter is passed to the default ErrorHandler
* #param bool $logErrorDetails -> Display error details in error log
* which can be replaced by a callable of your choice.
* Note: This middleware should be added last. It will not handle any exceptions/errors
* for middleware added after it.
*/
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
// Define app routes
$app->get('/hello/{name}', function (Request $request, Response $response, $args) {
$name = $args['name'];
$response->getBody()->write("Hello, $name");
return $response;
});
// Run app
$app->run();
Output:
Slim Application Error
The application could not run because of the following error:
Details
Type: Slim\Exception\HttpNotFoundException
Code: 404
Message: Not found.
File: /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php
Line: 91
Trace:
#0 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(57): Slim\Middleware\RoutingMiddleware->performRouting(Object(Slim\Psr7\Request))
#1 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/MiddlewareDispatcher.php(132): Slim\Middleware\RoutingMiddleware->process(Object(Slim\Psr7\Request), Object(Slim\Routing\RouteRunner))
#2 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(89): class#anonymous->handle(Object(Slim\Psr7\Request))
#3 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/MiddlewareDispatcher.php(132): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Psr7\Request), Object(class#anonymous))
#4 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): class#anonymous->handle(Object(Slim\Psr7\Request))
#5 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/App.php(206): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request))
#6 /opt/lampp/htdocs/MyocappAPI/vendor/slim/slim/Slim/App.php(190): Slim\App->handle(Object(Slim\Psr7\Request))
#7 /opt/lampp/htdocs/MyocappAPI/public/index.php(41): Slim\App->run()
#8 {main}
I'm glad OP figured it out, but he didn't share his solution so here is what worked for me:
$app = AppFactory::create();
$app->setBasePath("/slimapp/public/index.php");
where the full path to my starter page is:
C:\xampp\htdocs\slimapp\public\index.php
To test my starter page, the URL I used was:
localhost/slimapp/public/index.php/hello/Beautiful
I think in Slim 3 you didn't need to manually set the base path, but you do in Slim 4. I don't know if it's a bug but this worked.
Slim 4 has some bugs in routing. So,Downgrade the slim version to 3.*
Reference:
https://discourse.slimframework.com/t/slim-4-httpnotfoundexception/3273/18

how can i send facebook message using selenium webdriver

I am able to login on facebook, able to open chat but unable to send any message
Below program code I have used:
//Login on FB >> Working fine
driver.findElement(By.xpath(".//*[#id='email']")).sendKeys("******#gmail.com");
driver.findElement(By.xpath(".//*[#id='pass']")).sendKeys("********");
driver.findElement(By.xpath(".//*[#id='u_0_l']")).click();
// click on message icon >> Working fine
driver.findElement(By.xpath(".//*[#id='u_0_h']/li[1]/div/a/span")).click();
//click on friends name, to whom i want to send message >> Working fine
driver.findElement(By.xpath("/html/body/div[1]/div[1]/div/div/div/div[1]/div/div/div[2]/ul/li[5]/div/div[2]/div/div[3]/div/div[1]/div/div/ul/li[2]/a")).click();
Thread.sleep(5000);
//Send message >>>> here, i am not getting any response, code run without entered any message or error
driver.findElement(By.xpath(".//*[#class='_552h _35li _n4k']")).sendKeys("Hiii");
driver.findElement(By.xpath("/html/body/div/div[5]/div[1]/div/div/div[1]/div/div[1]/div[2]/div/div/div/div/div[4]/div[5]/div[1]/div/div/div[2]/div/div/div")).sendKeys(Keys.ENTER);;
I have used this code, it works for me.
driver.findElement(By.xpath("//div[contains(#class,'_5rpu') and #role='combobox']")).sendKeys("hi"+Keys.ENTER);
require 'selenium-webdriver'
#driver = Selenium::WebDriver.for :chrome
#driver.get 'https://www.facebook.com/fname.lname?fref=none'
a = #driver.find_element(:xpath, '//[#id="email"]').send_keys('aaa#gmail.com')
a = #driver.find_element(:xpath, '//*[#id="pass"]').send_keys('12345678')
a = #driver.find_element(:xpath, '//*[#value="Log In"]').click
sleep 5
a = #driver.find_element(:xpath, '//a[#href="/messages/fname.lname" and #role="button"]').click
sleep 2;p 'This is Where I clicked/initiated the Send Message '
a = #driver.find_element(:xpath, '//div[#class="_1ia"]/descendant::div[#class="_5rpu" and #role="textbox"]')
a.send_keys('Hi There') # This is where I entered the keys and Did Enter
a.send_keys:enter
The correct answer since the #role has changed is :
WebElement sendmsg = driver
.findElement(By.xpath("//div[#class='_1ia']/descendant::div[#class='_5rpu' and #role='combobox']"));
sendmsg.sendKeys("Just testing: using selenium webdriver" + Keys.ENTER);

There is no device with ID Using Zend and WURFL

I have integrate WURFL 1.6.0 with Zend every thing goes smooth it detects the desktop but in case of Android i am getting this error .On digging in deep i found out that my dir data/wurfl/cache is not loading with any data i have given it 777 permission but still it didnt work.
[25-Jun-2015 09:39:09] PHP Fatal error:
Uncaught exception 'Exception' with message 'There is no device with ID [generic_android_ver4_4] in the loaded WURFL Data' in /var/www/vhosts/mobiletocash.co.uk/httpdocs/library/wurfl-php-1.6.0.1/WURFL/CustomDeviceRepository.php:108
Stack trace:
#0 /var/www/vhosts/mobiletocash.co.uk/httpdocs/library/wurfl-php-1.6.0.1/WURFL/CustomDeviceRepository.php(211): WURFL_CustomDeviceRepository->getDevice('generic_android...')
#1 /var/www/vhosts/mobiletocash.co.uk/httpdocs/library/wurfl-php-1.6.0.1/WURFL/WURFLService.php(146): WURFL_CustomDeviceRepository->getDeviceHierarchy('generic_android...')
#2 /var/www/vhosts/mobiletocash.co.uk/httpdocs/library/wurfl-php-1.6.0.1/WURFL/WURFLService.php(62): WURFL_WURFLService->getWrappedDevice('generic_android...', Object(WURFL_Request_GenericRequest))
#3 /var/www/vhosts/mobiletocash.co.uk/httpdocs/library/wurfl-php-1.6.0.1/WURFL/WURFLManager.php(90): WURFL_WURFLService->getDeviceForRequest(Object(WURFL_Request_GenericRequest))
#4 /var/www/vhosts/mobiletocash.co.uk/httpdocs/library in /var/www/vhosts/mobiletocash.co.uk/httpdocs/library/wurfl-php-1.6.0.1/WURFL/CustomDeviceRepository.php on line 108
$resourcesDir = dirname(__FILE__) . '/../../data/wurfl/';
$wurfl['main-file'] = $resourcesDir . 'wurfl.xml';
$wurfl['patches'] = array($resourcesDir . 'web_browsers_patch.xml');
$cache['provider'] = 'Null';
//
$persistence['provider'] = 'File';
$persistence['dir'] = $resourcesDir . '/cache/';
$configuration['wurfl'] = $wurfl;
$configuration['persistence'] = $persistence;
$configuration['cache'] = $cache;
if i give $cache['provider'] = null;
it throws another exception . tried using $persistence['provider'] = 'file'; but no use
From what I can tell it does not look like the WURFL file is being properly loaded (perhaps the directory is not writeable) or is out of date. You most likely need to delete the persistence directory and reload the WURFL API.

phonegap 3.1 BarcodeScanner uncaught module cordova/plugin/BarcodeScanner not found

I'm new on Phonegap and JS... and I tried it with a barcode scanner... I installed the phonegap and everything with this tutorial http://teusink.blogspot.com/2013/07/guide-phonegap-3-android-windows.html
I installed the BarcodeScanner from CMD and exported the project as android platform...
Add it to Eclipse ... followed all the tutorials how to do it, added all permissions and stuff..
when i try the app on ma samsung tab2 ... the app comes up but when i click the "scan" link i get the error uncaught module cordova/plugin/BarcodeScanner not found in the logcat.
this is the call <a href="#" class="btn large" onclick="scaning();">Scan</a
i have this in the index html head
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
this is the scaning function
function scaning(){
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);};
and this is in the config.xml
<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
</feature>
I think I checked the whole Google for the answer ... but till now nothing worked... and still for the phonegap 3.0+ version there is almost none documentation for the barcode scanner ... at least for a beginner ...
if you can help me guys .... couse I'm totally lost :S
Although I've never used older versions as I'm quite new into Phonegap/Cordova, Version 3.1 seems to use a slightly different approach for accessing plugins. Following worked for me with Cordova 3.1 and BarcodeScanner.
Install plugin with
plugman install --platform android --project=DIR-TO-CORDOVA-PROJECT --plugin=https://github.com/wildabeast/BarcodeScanner
You don't have to reference barcodescanner.js by your own, cordova takes care of the includes - the example code from https://github.com/wildabeast/BarcodeDemo worked except I had to change the plugin path from
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
to
var scanner = cordova.require("com.phonegap.plugins.barcodescanner.BarcodeScanner");
edit the file: js/index.js
find the code: var scanner = cordova.require("cordova/plugin/BarcodeScanner");
replace "cordova/plugin/BarcodeScanner"
to "com.phonegap.plugins.barcodescanner.BarcodeScanner"
This one worked for me:
var scanner = cordova.plugins.barcodeScanner;
Had the same problem , got fixed by installing it via plugman like this
plugman install --platform android --project=DIR-TO-CORDOVA-PROJECT --plugin=https://github.com/wildabeast/BarcodeScanner
where DIR-TO-CORDOVA-PROJECT is E:/ProjectName/platform/android
If I didn't add the /platform/android it gave an error
and then put this in the scanning() function
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);