IBM MobileFirst -- get location - ibm-mobilefirst

I have MobileFirst (V7.O) app . How do I get the current latitude/Longitude for the device. Basically, I am recording some information at various point in my app and user can be moving.. So, at various instance, I would like to get the current lat/log..
Can you please provide some hints and how to get this information
Thanks for your help

Cordova is bundled in your MobileFirst project. As such you can take use of Cordova APIs to achieve this.
See the following (scroll down to the API usage): https://github.com/apache/cordova-plugin-geolocation
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
//
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError);

Related

How to manage response assertion if the values are same but sequence changes in Jmeter

I am getting response, let's suppose {"profiles":{"HLS_1200":[{"profile_id":38,"quality_id":11}],"ADAPTIVE" {"L","XL","XXL"}, now every time when we hit the API the response is same but the sequence is getting changed and therefore assetion is getting failed.
Next time I will get the response like {"profiles":{"HLS_1200":[{"profile_id":38,"quality_id":11}],"ADAPTIVE" {"XL","L","XXL"},
I want to pass this response assertion even if the sequence is changed.
Go for JSONAssert library which performs "deep scans" and doesn't care about the order of the attributes
Obtain the following libraries and drop them to JMeter Classpath:
android-json-0.0.20131108.vaadin1.jar
jsonassert-1.5.0.jar
Restart JMeter to pick up the libraries
Add JSR223 Assertion as a child of the request which returns your JSON
Put the following code into "Script" area:
def expected = '{\n' +
' "profiles": {\n' +
' "HLS_1200": [\n' +
' {\n' +
' "profile_id": 38,\n' +
' "quality_id": 11\n' +
' }\n' +
' ],\n' +
' "ADAPTIVE": [\n' +
' "L",\n' +
' "XL",\n' +
' "XXL"\n' +
' ]\n' +
' }\n' +
'}'
org.skyscreamer.jsonassert.JSONAssert.assertEquals(expected, prev.getResponseDataAsString(), false)
More information:
Introduction to JSONassert
Scripting JMeter Assertions in Groovy - A Tutorial

Is there a way to add line break in react-native-email?

I have a feedback page, I am looking to have a section where onPress of a button the application opens the users default email service application and sends typed user feedback to a pre-configured email. I have accomplished all of this using react-native-email.
The captured user TextInput does go into the body of the email. However, there are no line breaks and this looks cluttered. I'm hoping to understand if there are any formatting tools to use with react-native-email, or if there is a way to simply add line breaks.
Here is the sample code
handleEmail = () => {
const to = ['caleb.dockal#gmail.com'];
email(to, {
cc: ['caleb.dockal#gmail.com'],
subject: 'Feedback',
body:
'What feature would you like to see in the app?' +
'\n' +
this.state.answer1 +
'\n' +
' How could we improve your experience? ' +
'\n' +
this.state.answer2 +
'\n' +
' How can we improve the rating system? ' +
this.state.answer3 +
' What information would you like to see about listed businesses? ' +
this.state.answer4 +
' How did you hear about the app? ' +
this.state.answer5 +
' What countries would you like to see the app in? '
this.state.answer6,
}).catch(console.error);
};```
I have tried inserting '\n' in between the strings and state objects and this does not work. Does anyone know of a solution?

Katalon Studio - Cannot send the test request: Invalid start or end

I'm trying to send 'POST' web request to specific address (for example: https://qa.alycedev.com/)
Any properties set (header, body, cookies, url encode/decode) leads to error while sending my web request:
Warning > Cannot send the test request. Reason:
java.lang.IllegalArgumentException: invalid start or end.
Below you can find details of error:
https://i.stack.imgur.com/szGan.png
Example of my request:
#Keyword
def purchase_simple (def totalCookies) {
WebUI.comment('Total number of cookies=' +totalCookies.size())
RequestObject ro = new RequestObject('A')
ro.setRestRequestMethod('POST')
ro.setRestUrl('https://qa.alycedev.com/gifter/dashboard')
def httpheader = new ArrayList<TestObjectProperty>()
httpheader.add(new TestObjectProperty('Content-Type', ConditionType.EQUALS, 'application/json'))
httpheader.add(new TestObjectProperty('Accept', ConditionType.EQUALS, 'application/json'))
for (Cookie currentCookie : totalCookies) {
httpheader.add(new TestObjectProperty('Cookie', ConditionType.EQUALS, 'domain='+currentCookie.getDomain() + '; '+currentCookie.getName() + '=' + currentCookie.getValue() + '; expires='+currentCookie.getExpiry() + '; Max-Age=7200; path=/;'))
}
ro.setHttpHeaderProperties(httpheader)
def body = '{"_token": "' + GlobalVariable.G_api_oauth.csrfToken + '","use_credits": ' + GlobalVariable.G_product.price + ',"use_payment": 0.00,"currency_id": 1,"total_price": ' + GlobalVariable.G_product.price + ',"payment_data" : null,"gift_send_data": "{"id":' + GlobalVariable.G_gift.id + ',"product_id":' + GlobalVariable.G_product.id + ',"total_price":' + GlobalVariable.G_product.price + ',"send_now":true,"schedule_at":"","send_type":"hwcard","gifter_company":"Apple","giftee_company":"Sony","from":null,"gifter_address":{"country":{"id":1,"name":"United States","code":"US","image":""},"country_id":1,"address":"Address","address2":"Address 2","city":"City","state":"State","zipcode":"123321"},"giftee_address":{"country":{"id":1,"name":"United States","code":"US","image":""},"country_id":1,"address":"Address","address2":"Address 2","city":"City","state":"State","zipcode":"123321"},"message_to_giftee":{"id":1,"default":1,"message":"Messages subject + 10 characters.","subject":"Something for your time","name":"Something for your time"},"prospect":{"capture_date":true,"capture_email":true,"capture_phone":true,"capture_question":false,"capture_affidavit":false,"gifter_affidavit":"","gifter_question":""},"delivery_method_data":{"type":"branded_box"}}"}'
ro.setBodyContent(new HttpTextBodyContent(body, 'UTF-8', 'application/json'))
WebUI.comment(ro.activeProperties.toArray().toString())
try{
def response = WSBuiltInKeywords.sendRequest(ro)
}
catch(Exception ex) {
println(ex.detailMessage)
println(ex.stackTraceDepth.toString())
}
}

How to Retrieve all possible information about a LinkedIn Account ? (API using C#)

I am writting an C# app to make use of Linkedin's API.
I want to be able to query "Person" (First Name + Last Name) and retrieve all the possible information about this group of people with the same name
I am currently using my own implementation of the REST API alongside People-Search API calls.
Here's an example of a request that I know works:
https://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,headline,picture-url),num-results)?
I'm running it with: first-name=parameter&last-name=parameter after the ? mark
The problem is, I want to retrieve more information such as Title, Industry, Current-company, current-school etc. Refer here for the list of possible parameters.
This notation is what they call Field Selectors
How do i structure my API Call so i can get all the possible information about someone ?
Here is the url to get everything for a user Profile:
https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,picture-url,industry,summary,specialties,positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes),associations,interests,num-recommenders,date-of-birth,publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url),languages:(id,language:(name),proficiency:(level,name)),skills:(id,skill:(name)),certifications:(id,name,authority:(name),number,start-date,end-date),courses:(id,name,number),recommendations-received:(id,recommendation-type,recommendation-text,recommender),honors-awards,three-current-positions,three-past-positions,volunteer)?oauth2_access_token=PUT_YOUR_TOKEN_HERE
Requires an Oauth2 access token.
Here it is in a nice String list (Java):
apiUrl
+ "/v1/people/~:("
+ "id,"
+ "first-name,"
+ "last-name,"
+ "headline,"
+ "picture-url,"
+ "industry,"
+ "summary,"
+ "specialties,"
+ "positions:("
+ "id,"
+ "title,"
+ "summary,"
+ "start-date,"
+ "end-date,"
+ "is-current,"
+ "company:("
+ "id,"
+ "name,"
+ "type,"
+ "size,"
+ "industry,"
+ "ticker)"
+"),"
+ "educations:("
+ "id,"
+ "school-name,"
+ "field-of-study,"
+ "start-date,"
+ "end-date,"
+ "degree,"
+ "activities,"
+ "notes),"
+ "associations," /* Full Profile */
+ "interests,"
+ "num-recommenders,"
+ "date-of-birth,"
+ "publications:("
+ "id,"
+ "title,"
+ "publisher:(name),"
+ "authors:(id,name),"
+ "date,"
+ "url,"
+ "summary),"
+ "patents:("
+ "id,"
+ "title,"
+ "summary,"
+ "number,"
+ "status:(id,name),"
+ "office:(name),"
+ "inventors:(id,name),"
+ "date,"
+ "url),"
+ "languages:("
+ "id,"
+ "language:(name),"
+ "proficiency:(level,name)),"
+ "skills:("
+ "id,"
+ "skill:(name)),"
+ "certifications:("
+ "id,"
+ "name,"
+ "authority:(name),"
+ "number,"
+ "start-date,"
+ "end-date),"
+ "courses:("
+ "id,"
+ "name,"
+ "number),"
+ "recommendations-received:("
+ "id,"
+ "recommendation-type,"
+ "recommendation-text,"
+ "recommender),"
+ "honors-awards,"
+ "three-current-positions,"
+ "three-past-positions,"
+ "volunteer"
+ ")"
+ "?oauth2_access_token="+ token;
You've already got the notation down, all you need to do is add the rest of the field selectors, nesting them where needed:
https://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,headline,picture-url,industry,positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes)),num-results)?first-name=parameter&last-name=parameter
Keep in mind that per the Profile Field docs, you can only get educations for 1st degree connections of the current user.
I use this URL to get everything including email and formatted as json:
https://api.linkedin.com/v1/people/~:(id,first-name,email-address,last-name,headline,picture-url,industry,summary,specialties,positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes),associations,interests,num-recommenders,date-of-birth,publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url),languages:(id,language:(name),proficiency:(level,name)),skills:(id,skill:(name)),certifications:(id,name,authority:(name),number,start-date,end-date),courses:(id,name,number),recommendations-received:(id,recommendation-type,recommendation-text,recommender),honors-awards,three-current-positions,three-past-positions,volunteer)?format=json

how to obtain version of app?

Is there a way to obtain a version number of a Titanium app?
e.g when installed on an iOS device then perhaps obtain the CFBundleVersion and when installed on Android then obtain its version number.
UPDATED: I was looking in the Titanium.Platform documentation for the app version number. The app version number is under Titanium.App.
Here is my code for sending the version number of my app to the server, so that the server can provide different content depending on the app-version-number.
function obtain_request_header() {
var caps = Titanium.Platform.displayCaps;
var s0 = 'appversion=' + Titanium.App.version;
var s1 = 'osname=' + Titanium.Platform.osname + ',name=' + Titanium.Platform.name + ',version=' + Titanium.Platform.version + ',model=' + Titanium.Platform.model;
var s2 = 'width=' + caps.platformWidth + ',height=' + caps.platformHeight + ',dpi=' + caps.dpi;
return s0 + ',' + s1 + ',' + s2;
}
To obtain the version of your application regardless of OS, simply use:
Titanium.App.version