My mobile first studio plugin version is 7.1.0.00-20161006-0540. We have upgraded to the latest iFix IMF 00-20161118-2214 for server.
We just started with the sample code provided in IBM knowledge center for JSONstore, but we got error -11 OPERATION_FAILED_ON_SPECIFIC_DOCUMENT
We called the JSONStore Initialization using JavaScript from WLinit Then only we will get this error -11, if it is in outside of Wlinit it's not showing anything in console.
We already mentioned JSONSTORE in application descriptor file
Finally I find the problem.
Issue was in config.xml
Feature tag name was wrong here. I replaced StoragePluginStoragePlugin to StoragePlugin.
In new iFix also having the same problem.
Thanks
Calling JSONStore from WLInit (in initOptions.js?) is not a place to do the initialize for JSONStore...
You should initialize a JSONStore collection in your main.js, inside function wlCommonInit(), like so:
function wlCommonInit() {
var collections = {
people : {
searchFields: {name: 'string', age: 'integer'}
}
};
WL.JSONStore.init(collections).then(function (collections) {
// handle success - collection.people (people's collection)
alert("success);
}).fail(function (error) {
// handle failure
alert ("failure");
});
}
Related
I'm having a hard time getting WalletConnect 1.7.7 to work on React Native. I want to integrate in a crypto Wallet to handle dapps requests. Their documentation is...lacking. I'm following the "quickstart" in their docs, but listeners never gets fired.
import WalletConnect from "#walletconnect/client";
// Create connector
const connector = new WalletConnect(
{
// Required
uri: "wc:8a5e5bdc-a0e4-47...TJRNmhWJmoxdFo6UDk2WlhaOyQ5N0U=",
// Required
clientMeta: {
description: "WalletConnect Developer App",
url: "https://walletconnect.org",
icons: ["https://walletconnect.org/walletconnect-logo.png"],
name: "WalletConnect",
},
});
connector.on("session_request", (error, payload) => {
if (error) {
throw error;
}
// Handle Session Request
});
But session_request or any other event never get's fired. As per their documents that's all I need. Is there anything else I'm missing or perhaps it's not documented?
The documentation for Wallet Connect is very incomplete and there is very little information on the web. Are you using React Native with Expo? Because there the implementation changes. I don't see any flaws in your code. Test your integration from this website https://example.walletconnect.org/.
Using connect event instead of session_request on walllet connect works for me in react native.
connector.on('connect',(error,payload)=>{
console.log('eventtt',payload)
// Alert.alert('Connected')
})
Hey there to everyone!
I'm posting my first question so I'll try to be as clear as possible!
I'm building a native android app using react-native(0.61.5), I'm using setState hook instead of the classic state and I want to use the react-native-call-detection library(1.8.2).
What is the problem?
function startListenerTapped() {
console.log('start');
callDetector = new CallDetectorManager((event, number) => {
console.log(event);
console.log('inside call detector');
if (event === 'Missed') {
console.log(event);
console.log(number);
setMissedCaller(number);
}
},
true,
() => { console.error('access denied') },
{
title: 'Phone State Permission',
message: 'This app needs access to your phone state in order to react and/or to adapt to incoming calls.'
}
)
}
I run this function when my component mounts, callDetector is set as undefined, I get the 'start' log but when I simulate a call on my AVD nothing happens.
From what I understood the CallDetectorManager works like an event listener, right?
Or do I need to start it every time a call happens?
Another thing I've had a problem with was when I was trying to run a build for the app. I have Gradle 6.0 and I had an error with the react-native-call-detection:
Attribute application#allowBackup value=(false) from AndroidManifest.xml:13:7-34
is also present at [:react-native-call-detection] AndroidManifest.xml:21:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at
AndroidManifest.xml:7:5-117 to override.
I couldn't really understand what this meant, and the only thing that I've found that solved it was to create a react-native.config.js file with this line of code in it:
module.exports = { dependencies: { 'react-native-call-detection': { platforms: { android: null, }, }, }, };
Another thing that I've only noticed now is that I have a problem with the module of the library.
Could not find a declaration file for module 'react-native-call-detection'.
'c:/folders/projectName/node_modules/react-native-call-detection/index.js' implicitly has an 'any' type.
Try `npm install #types/react-native-call-detection` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-call-detection';`
Does anybody knows what that means?!
I think I start to think that it means that I need to find an alternative to this library... AHAHA!
Any kind of help or solution would be more than welcome!
Thanks in advance for everything!
We're doing this in the web version of our react application and our native Android app so our setup and everything is working fine. I'm trying to implement sharing an action in react-native using react-native-fbsdk. I'm following the Android code because it looks the closest to the react-native-fbsdk code.
Should I be using ShareApi.share or something else?
I tried creating an instance of ShareOpenGraphContent to use with ShareApi.share, but there's no constructor.
I wish they would provide more thorough documentation :s
Based on the code my colleague used for the ShareApi on Android it seems like react-native-fbsdk is missing a few things related to sharing actions.
ShareOpenGraphContent isn't directly exported from react-native-fbsdk so this
import { ShareOpenGraphContent } from 'react-native-fbsdk';
Actually doesn't work. There must be some way to use the ShareApi in react-native-fbsdk to share an action...I'm just missing something.
Someone help...please.
Thanks!!
I figured it out! I had to manually create an instance of the ShareOpenGraphContent object which has 3 mandatory properties: contentType, action and previewPropertyName. The react-native-fbsdk doesn't currently have a constructor for this object type.
ShareApi.canShare isn't mandatory, but it checks to ensure you have the correct permissions before trying to share. This would allow you to get the user logged in before trying in case their token expired, or the user hasn't agreed to the needed permissions yet.
const ogAction = new ShareOpenGraphAction('<your_facebook_namespace>' + ':' + '<your_facebook_action>');
ogAction.putString('song', 'https://<url_to_your_song_app_etc>');
ogAction.putString('place', '<fbPlacePageID>'');
ogAction.putNumber('fb:explicitly_shared', 1); // Normally this is a boolean, but putNumber with a value of 1 works
// Manually create an instance of ShareOpenGraphContent (no constructor in the API)
const ogContent = {
contentType: 'open-graph',
action: ogAction,
previewPropertyName: 'song',
};
ShareApi.canShare(ogContent).then((canShare) => {
if (canShare)
return ShareApi.share(ogContent, '/me');
}).then(
function(result) {
// Shared successfully
},
function(error) {
// Failed to share
}
);
I'm using Worklight 6.2 to build a simple example of data sync using JSONStore and a SQL Adapter.
Everything seems to be working the way I want, except for the "push" back to the adapter. My application pulls data via the "load()". I allow the user to select an item, change it, and then "replace()" inside the collection. However, when I call "push()", nothing happens. No errors - nada. I'm hoping this is a simple "typo" problem, but I'm stumped at this point.
Any input would be GREATLY appreciated!
-bob-
Things that are working:
WL.JSONStore.init(),
WL.JSONStore.load(),
WL.JSONStore.findAll(),
WL.JSONStore.find(),
WL.JSONStore.replace(),
WL.JSONStore.pushRequiredCount()
What's not working is the last and most important:
WL.JSONStore.push();
Here's my sync code:
function syncWithServer(){
// THIS FIRST PART WORKS - YAY!!!!!
console.log ("Check for dirty records");
WL.JSONStore.get(employeeCollectionName).pushRequiredCount()
.then(function (numberOfDirtyDocuments) {
alert("DIRTY: " + numberOfDirtyDocuments);
})
.fail(function (errorObject) {
alert (errorObject);
});
/ NOTHING HAPPENS AFTER THE LOG - JUST FALLS THRU TO THE LAST CONSOLE LOG
// NO ERRORS OR ANYTHING
console.log("Atempting to update server");
WL.JSONStore.get(employeeCollectionName).push()
.then ( function (res) {
alert("Server updated successfully");
})
.fail ( function (errorObject){
alert (errorObject);
});
console.log("HUmmmmmm .....");
}
Your application seems to be doing the right thing, so this could be a defect. However, the push() and load() API are deprecated as of 6.2, and I think that if you follow the new approach it will work for you.
The new approach is to call the adapter directly; this is all that JSONStore did anyways when you called push() or load(), while constraining you to what parameters you can send to it, so it makes more sense that you call the adapter directly. For push, you can edit your push call like this:
WL.JSONStore.get(employeeCollectionName).getAllDirty()
.then(function (dirtyDocs) {
return WL.Client.invokeProcedure({
adapter : 'people',
procedure : 'updatePeople',
parameters : [ dirtyDocs ]
});
})
.then(function (responseFromAdapter) {
// ... call markClean API after a valid response form the adapter
});
Making sure to change the parameters and procedure and adapter name to your adapter's.
Also, this answer is a very short summary of what is in the documentation for working with external data, including examples on how to do push and pull (load).
That said, even though push() and load() are deprecated, they should still work, so a defect has been created to look further into this.
I ran your test app from you GitHub account and I was able to run it fine using an HTTP adapter and the callbacks returning correctly. Which logs did you receive when using an SQL adapter, if any.
[EDIT ~ 8/6] I created an SQL adapter and was able to push and pull from the adapter.
I am attempting to initalize the IBM Worklight JSON store as below:
//JSONStore jsonStoreCollection metadata
var jsonStoreCollection = {};
//JSONStore jsonStoreCollection metadata
var COLLECTION_NAME = 'people';
function wlCommonInit(){
// Create empty options to pass to
// the WL.JSONStore.init function
var options = {};
//Define the collection and list the search fields
jsonStoreCollection[COLLECTION_NAME] = {
searchFields : {name: 'string'},
};
//Initialize the JSON store collection
WL.JSONStore.init(jsonStoreCollection, options)
.then(function () {
console.log("Successfully Initialized the JSON store");
})
.fail(function (errorObject) {
console.log("JSON store init failed :( ");
});
}
But when I run this in my android emulator the logcat gives me the "JSON store init failed" message. And the following error:
[wl.jsonstore {"src":"initCollection", "err":-2,"msg":"PROVISION_TABLE_SEARCH_FIELDS_MISMATCH","col":"token","usr":"jsonstore","doc":{},"res":{}}
This implementation seems to be very much what is outlined in the documentation, however I cannot get it to initialize.
Can anyone tell me what I am doing wrong here?
The documentation with the error codes is here.
-2 PROVISION_TABLE_SEARCH_FIELDS_MISMATCH
Search fields are not dynamic. It is not possible to change search fields without calling
the destroy method or the removeCollection method in the WL.JSONStore
class before calling the init method with the new search fields. This
error can occur if you change the name or type of the search field.
For example: {key: 'string'} to {key: 'number'} or {myKey: 'string'}
to {theKey: 'string'}.
No need to uninstall the application, just follow the documentation and handle that error case by calling removeCollection or destroy. For example:
WL.JSONStore.init(...)
.then(function () {
//init was successful
})
.fail(function (error) {
//check for -2
//call removeCollection or destroy
//re-init with new search fields
});
You can always submit a feature request to make this easier.
If you have previously created a JSON store with the same name but with different initialization variables. You must uninstall the application.
After uninstalling you can re-deploy the application to the device and the JSON store will initialize as expected.
Since discovering this, I have seen the issue a couple more times as I made changes to the configuration of my JSON store in my Worklight application.