我的输入数据如下。我如何解析这个从我的应用程序发送到适配器。通过给出PUT请求和适配器示例代码的一些示例来帮助我。
var data = {
"apps" : [{
"pkg" : "com.google.android.youtube",
"version" : 112753132
}, {
"pkg" : "com.motorola.motocare",
"version" : 2
}, {
"pkg" : "com.android.providers.telephony",
"version" : 22
}, {
"pkg" : "com.google.android.gallery3d",
"version" : 40301
}, {
"pkg" : "io.appium.settings",
"version" : 1
}, {
"pkg" : "com.google.android.googlequicksearchbox",
"version" : 300682618
}, {
"pkg" : "com.android.providers.calendar",
"version" : 22
}, {
"pkg" : "com.android.providers.media",
"version" : 800
}, {
"pkg" : "com.google.android.apps.docs.editors.docs",
"version" : 62731433
}, {
"pkg" : "com.google.android.onetimeinitializer",
"version" : 22
}, {
"pkg" : "com.xe.currency",
"version" : 101
}, {
"pkg" : "com.motorola.bug2go",
"version" : 0
}, {
"pkg" : "com.motorola.camera",
"version" : 50002104
}, {
"pkg" : "com.android.wallpapercropper",
"version" : 22
}, {
"pkg" : "com.sample.printer",
"version" : 1
}, {
"pkg" : "com.javacodegeeks.android.locationservicetest",
"version" : 1
}, {
"pkg" : "com.konylabs.WAI",
"version" : 1
}, {
"pkg" : "com.verizon.permissions.vzwappapn",
"version" : 1
}, {
"pkg" : "com.motorola.ccc.devicemanagement",
"version" : 1
}, {
"pkg" : "com.motorola.android.fmradio",
"version" : 22
}, {
"pkg" : "com.motorola.sensorhub.stml0.updater",
"version" : 3017003
}, {
"pkg" : "com.stgit.jumionative",
"version" : 1
}, {
"pkg" : "com.android.documentsui",
"version" : 22
}, {
"pkg" : "com.android.externalstorage",
"version" : 22
}, {
"pkg" : "com.android.htmlviewer",
"version" : 22
}, {
"pkg" : "com.javapapers.android.androidgps",
"version" : 1
}, {
"pkg" : "com.motorola.hotspotlauncher",
"version" : 1
}, {
"pkg" : "com.android.mms.service",
"version" : 22
}, {
"pkg" : "com.android.providers.downloads",
"version" : 22
}, {
"pkg" : "com.motorola.wappushsi",
"version" : 1
}, {
"pkg" : "com.motorola.android.sdm.plugins.connmo",
"version" : 1
}, {
"pkg" : "com.example.android.testing.espresso.BasicSample.test",
"version" : 0
}, {
"pkg" : "com.motorola.android.settings.diag_mdlog",
"version" : 4
}, {
"pkg" : "com.vzw.hss.myverizon",
"version" : 40
}, {
"pkg" : "com.android.browser.provider",
"version" : 22
}, {
"pkg" : "com.motorola.entitlement",
"version" : 22
}, {
"pkg" : "com.motorola.ccc.checkin",
"version" : 1
}, {
"pkg" : "com.motorola.programmenu",
"version" : 22
}, {
"pkg" : "com.handyapps.currencyexchange",
"version" : 56
}, {
"pkg" : "paxcreation.com.multipleviewinrecycleview",
"version" : 1
}, {
"pkg" : "com.motorola.ccc.mainplm",
"version" : 1
}, {
"pkg" : "com.motorola.motgeofencesvc",
"version" : 10001
}, {
"pkg" : "com.google.android.configupdater",
"version" : 22
}, {
"pkg" : "com.motorola.groundloopnoisepreventer",
"version" : 10101
}, {
"pkg" : "com.orgname.linkedIn",
"version" : 1
}, {
"pkg" : "com.motorola.ccc.cce",
"version" : 6
}, {
"pkg" : "com.motorola.ccc.ota",
"version" : 71000
}, {
"pkg" : "com.motorola.ccc.notification",
"version" : 1
}, {
"pkg" : "com.orgname.password",
"version" : 1
}, {
"pkg" : "com.android.defcontainer",
"version" : 22
}, {
"pkg" : "com.android.providers.downloads.ui",
"version" : 22
}, {
"pkg" : "com.android.vending",
"version" : 80750800
}, {
"pkg" : "com.android.pacprocessor",
"version" : 22
}, {
"pkg" : "com.motorola.pgmsystem2",
"version" : 22
}, {
"pkg" : "com.stgit.audio",
"version" : 1
}, {
"pkg" : "com.motorola.bodyguard",
"version" : 10257
}, {
"pkg" : "com.motorola.motodisplay.env",
"version" : 22
}, {
"pkg" : "com.joeykrim.rootcheck",
"version" : 136
}, {
"pkg" : "com.motorola.demomode",
"version" : 22
}, {
"pkg" : "com.android.certinstaller",
"version" : 22
}, {
"pkg" : "com.mobisystems.fileman",
"version" : 14500
}, {
"pkg" : "com.google.android.marvin.talkback",
"version" : 40501000
}, {
"pkg" : "com.motorola.android.sdm.plugins.diagmon",
"version" : 22
}, {
"pkg" : "com.InvokingAdapterProcedures",
"version" : 1
}, {
"pkg" : "android",
"version" : 22
}, {
"pkg" : "com.android.contacts",
"version" : 22
}, {
"pkg" : "com.motorola.android.provisioning",
"version" : 1
}, {
"pkg" : "com.vzw.apnservice",
"version" : 12
}, {
"pkg" : "com.motorola.vzw.phone.extensions",
"version" : 1
}, {
"pkg" : "com.google.android.apps.inputmethod.hindi",
"version" : 457
}, {
"pkg" : "com.android.stk",
"version" : 22
}, {
"pkg" : "com.AuthenticateFingerPrint",
"version" : 1
}, {
"pkg" : "com.orgname.PushNotification",
"version" : 1
}, {
"pkg" : "com.android.backupconfirm",
"version" : 22
}, {
"pkg" : "com.motorola.migrate",
"version" : 16044
}, {
"pkg" : "com.motorola.vzw.settings.extensions",
"version" : 22
}, {
"pkg" : "com.manoj.dlt",
"version" : 202
}, {
"pkg" : "com.google.android.launcher",
"version" : 103001
}, {
"pkg" : "com.androidmyway.demo.proxymityalert",
"version" : 1
}, {
"pkg" : "com.google.android.deskclock",
"version" : 45200512
}, {
"pkg" : "com.mbfs.mra.android.tablet",
"version" : 1
}, {
"pkg" : "com.example.hello",
"version" : 10000
}, {
"pkg" : "com.google.android.gm",
"version" : 58315863
}, {
"pkg" : "com.kony.sample",
"version" : 1
}, {
"pkg" : "com.motorola.moodles",
"version" : 301
}, {
"pkg" : "com.motorola.motocit",
"version" : 117
}, {
"pkg" : "com.example.googleLogin",
"version" : 1
}, {
"pkg" : "com.koushikdutta.vysor",
"version" : 1477720800
}, {
"pkg" : "com.google.zxing.client.android",
"version" : 105
}, {
"pkg" : "com.google.android.setupwizard",
"version" : 200
}, {
"pkg" : "com.qualcomm.qcrilmsgtunnel",
"version" : 22
}, {
"pkg" : "com.ford.applinkcatalog",
"version" : 10001
}, {
"pkg" : "com.android.providers.settings",
"version" : 22
}, {
"pkg" : "com.android.sharedstoragebackup",
"version" : 22
}, {
"pkg" : "com.google.android.email",
"version" : 7008110
}, {
"pkg" : "com.kony.KitchenSinkApp",
"version" : 1
}, {
"pkg" : "com.google.android.music",
"version" : 3120
}, {
"pkg" : "com.android.printspooler",
"version" : 1
}, {
"pkg" : "com.sample.httpurl",
"version" : 1
}, {
"pkg" : "com.android.dreams.basic",
"version" : 22
}, {
"pkg" : "io.selendroid.testapp",
"version" : 1
}, {
"pkg" : "com.kony.FunctionPreviewApp",
"version" : 28
}, {
"pkg" : "com.motorola.MotGallery2",
"version" : 304138
}, {
"pkg" : "com.stgit.portfolio.dravya",
"version" : 1
}, {
"pkg" : "com.android.inputdevices",
"version" : 22
}, {
"pkg" : "com.motorola.android.nativedropboxagent",
"version" : 1
}, {
"pkg" : "com.motorola.android.jvtcmd",
"version" : 22
}, {
"pkg" : "com.lenovo.anyshare.gps",
"version" : 4030608
}, {
"pkg" : "com.motorola.motosignature.app",
"version" : 1
}, {
"pkg" : "com.dropbox.android",
"version" : 1120200
}, {
"pkg" : "com.vznavigator.Generic",
"version" : 907073
}, {
"pkg" : "com.motorola.android.buacontactadapter",
"version" : 22
}, {
"pkg" : "com.google.android.apps.cloudprint",
"version" : 113
}, {
"pkg" : "com.chrysler.tvauth",
"version" : 9
}, {
"pkg" : "com.google.android.apps.docs",
"version" : 62113533
}, {
"pkg" : "com.google.android.apps.maps",
"version" : 932100122
}, {
"pkg" : "com.google.android.apps.plus",
"version" : 416251307
}, {
"pkg" : "com.motorola.dataoffloading",
"version" : 1
}, {
"pkg" : "com.android.cellbroadcastreceiver",
"version" : 22
}, {
"pkg" : "com.google.android.webview",
"version" : 270408100
}, {
"pkg" : "com.motorola.fmrecording",
"version" : 22
}, {
"pkg" : "com.motorola.localwipe.policy",
"version" : 1
}, {
"pkg" : "com.motorola.contacts.preloadcontacts",
"version" : 1
}, {
"pkg" : "com.android.server.telecom",
"version" : 22
}, {
"pkg" : "com.google.android.syncadapters.contacts",
"version" : 22
}, {
"pkg" : "com.motorola.android.providers.settings",
"version" : 22
}, {
"pkg" : "com.android.facelock",
"version" : 22
}, {
"pkg" : "com.android.keychain",
"version" : 22
}, {
"pkg" : "com.google.android.gm.exchange",
"version" : 508255
}, {
"pkg" : "com.android.chrome",
"version" : 270408101
}, {
"pkg" : "com.zzgo.main",
"version" : 1
}, {
"pkg" : "com.SSOApp",
"version" : 1
}, {
"pkg" : "com.android.dialer",
"version" : 22
}, {
"pkg" : "com.sample.handlingcookies",
"version" : 1
}, {
"pkg" : "com.google.android.street",
"version" : 18102
}, {
"pkg" : "com.google.android.gms",
"version" : 9683234
}, {
"pkg" : "com.google.android.gsf",
"version" : 22
}, {
"pkg" : "com.google.android.tts",
"version" : 210309111
}, {
"pkg" : "com.google.android.partnersetup",
"version" : 22
}, {
"pkg" : "com.motorola.genie",
"version" : 104037
}, {
"pkg" : "com.motorola.nfcui",
"version" : 1
}, {
"pkg" : "com.motorola.setup",
"version" : 22
}, {
"pkg" : "com.CallerApp",
"version" : 1
}, {
"pkg" : "com.android.packageinstaller",
"version" : 22
}, {
"pkg" : "com.google.android.videos",
"version" : 36160
}, {
"pkg" : "stg.com.shuttleclient",
"version" : 1
}, {
"pkg" : "com.android.proxyhandler",
"version" : 22
}, {
"pkg" : "com.lmi.motorola.rescue",
"version" : 74522
}, {
"pkg" : "com.google.android.apps.hangoutsdialer",
"version" : 1642
}, {
"pkg" : "com.ionicframework.ionicgeolocationdemo761609",
"version" : 1
}, {
"pkg" : "com.customermobile.preload.vzw",
"version" : 10
}, {
"pkg" : "com.google.android.feedback",
"version" : 22
}, {
"pkg" : "com.google.android.calendar",
"version" : 2014102770
}, {
"pkg" : "com.motorola.onetimeinitializer",
"version" : 22
}, {
"pkg" : "com.android.managedprovisioning",
"version" : 22
}, {
"pkg" : "com.motorola.launcherconfig",
"version" : 10000000
}, {
"pkg" : "de.j4velin.wifiAutoOff",
"version" : 173
}, {
"pkg" : "com.example.yeshwanthkk.ocr",
"version" : 1
}, {
"pkg" : "com.android.dreams.phototable",
"version" : 22
}, {
"pkg" : "com.mapmywalk.android2",
"version" : 16060200
}, {
"pkg" : "com.motorola.moto",
"version" : 20301
}, {
"pkg" : "com.motorola.slpc",
"version" : 10112
}, {
"pkg" : "com.DCMobile",
"version" : 1
}, {
"pkg" : "com.orgname.Print",
"version" : 1
}, {
"pkg" : "com.example.distancematrix",
"version" : 1
}, {
"pkg" : "com.android.providers.partnerbookmarks",
"version" : 22
}, {
"pkg" : "com.google.android.gsf.login",
"version" : 22
}, {
"pkg" : "com.jms.zoomrotation",
"version" : 2
}, {
"pkg" : "com.motricity.verizon.ssodownloadable",
"version" : 229
}, {
"pkg" : "com.motorola.vzw.loader",
"version" : 22
}, {
"pkg" : "com.android.wallpaper.livepicker",
"version" : 22
}, {
"pkg" : "com.mmi.explore",
"version" : 16
}, {
"pkg" : "portfolio.stgit.com.portfolio",
"version" : 1
}, {
"pkg" : "com.example.helloapp",
"version" : 1
}, {
"pkg" : "com.example.webserviceexample",
"version" : 1
}, {
"pkg" : "com.motorola.motocare.internal",
"version" : 1
}, {
"pkg" : "com.example.yeshwanthkk.indoorpositioning",
"version" : 1
}, {
"pkg" : "com.chrysler.dailysales",
"version" : 10000
}, {
"pkg" : "com.Print",
"version" : 1
}, {
"pkg" : "org.mozilla.firefox",
"version" : 2015422361
}, {
"pkg" : "com.google.android.inputmethod.korean",
"version" : 745
}, {
"pkg" : "com.karthi.testApp",
"version" : 1
}, {
"pkg" : "com.motorola.fmplayer",
"version" : 1100089
}, {
"pkg" : "com.google.android.backuptransport",
"version" : 22
}, {
"pkg" : "com.motorola.audioeffects",
"version" : 22
}, {
"pkg" : "com.fsp.android.friendlocator",
"version" : 15200
}, {
"pkg" : "youten.redo.ble.ibeacondetector",
"version" : 3
}, {
"pkg" : "com.linkedin.android",
"version" : 88700
}, {
"pkg" : "com.android.settings",
"version" : 22
}, {
"pkg" : "com.google.android.inputmethod.pinyin",
"version" : 421
}, {
"pkg" : "com.stg.demokpns",
"version" : 1
}, {
"pkg" : "com.android.calculator2",
"version" : 22
}, {
"pkg" : "com.google.android.apps.books",
"version" : 30315
}, {
"pkg" : "com.qualcomm.location",
"version" : 1
}, {
"pkg" : "com.hecorat.azplugin",
"version" : 6
}, {
"pkg" : "com.lmi.motorola.rescuesecurity",
"version" : 74522
}, {
"pkg" : "com.motorola.slpc_sys",
"version" : 10001
}, {
"pkg" : "com.motorola.setupwizard.phoneservice",
"version" : 22
}, {
"pkg" : "com.example.linkedinintegration",
"version" : 1
}, {
"pkg" : "com.example.yeshwanthkk.beaconpositioning",
"version" : 1
}, {
"pkg" : "com.motorola.actions",
"version" : 111005
}, {
"pkg" : "com.ionicframework.ionicbeacon700665",
"version" : 18
}, {
"pkg" : "com.orgname.FirstSPA",
"version" : 1
}, {
"pkg" : "com.android.vpndialogs",
"version" : 22
}, {
"pkg" : "com.google.android.talk",
"version" : 23256370
}, {
"pkg" : "com.motorola.bach.modemstats",
"version" : 1
}, {
"pkg" : "com.SignInWithGoogle",
"version" : 1
}, {
"pkg" : "com.android.phone",
"version" : 22
}, {
"pkg" : "com.android.shell",
"version" : 22
}, {
"pkg" : "com.ibm.appcenter",
"version" : 80
}, {
"pkg" : "com.android.providers.userdictionary",
"version" : 22
}, {
"pkg" : "com.orgname.sample",
"version" : 1
}, {
"pkg" : "jp.co.omronsoft.iwnnime.ml",
"version" : 32
}, {
"pkg" : "com.orgname.DirectYourFriend",
"version" : 1
}, {
"pkg" : "com.android.location.fused",
"version" : 22
}, {
"pkg" : "com.android.systemui",
"version" : 22
}, {
"pkg" : "com.motorola.motodisplay",
"version" : 21110214
}, {
"pkg" : "com.fusionone.android.sync.vzbuaclient",
"version" : 2901144
}, {
"pkg" : "edu.sfsu.cs.orange.ocr",
"version" : 33
}, {
"pkg" : "com.motorola.setupwizard.devicesetup",
"version" : 1
}, {
"pkg" : "com.example.android.screencapture",
"version" : 0
}, {
"pkg" : "com.google.android.play.games",
"version" : 22090004
}, {
"pkg" : "io.appium.unlock",
"version" : 1
}, {
"pkg" : "com.google.android.apps.magazines",
"version" : 2015061020
}, {
"pkg" : "com.android.bluetooth",
"version" : 22
}, {
"pkg" : "com.qualcomm.timeservice",
"version" : 22
}, {
"pkg" : "com.google.android.androidforwork",
"version" : 22
}, {
"pkg" : "com.qualcomm.atfwd",
"version" : 22
}, {
"pkg" : "com.android.providers.contacts",
"version" : 22
}, {
"pkg" : "com.motorola.setupwizard.controller",
"version" : 22
}, {
"pkg" : "com.android.captiveportallogin",
"version" : 22
}, {
"pkg" : "com.motorola.so",
"version" : 2010001
}, {
"pkg" : "com.verizon.messaging.vzmsgs",
"version" : 30271
}, {
"pkg" : "com.verizon.llkagent",
"version" : 1
}, {
"pkg" : "com.motorola.android.dm.service",
"version" : 2
}, {
"pkg" : "com.gotv.nflgamecenter.us.lite",
"version" : 1110317
}, {
"pkg" : "com.verizon.permissions.appdirectedsms",
"version" : 1
}, {
"pkg" : "com.hp.android.printservice",
"version" : 86
}, {
"pkg" : "com.google.android.inputmethod.latin",
"version" : 24512315
}
]
};
如何使用WLResourceRequest从客户端向适配器发送此消息?
答案 0 :(得分:0)
您可以使用WLResourceRequest.sendFormParameters(json)
执行此操作。有关详情refer to this link。
要在单个WLResourceRequest调用中一起发送json,queryparameters,header等,请参阅代码段并示例in this link。
答案 1 :(得分:0)
如果在将数据变量分配给params变量之前对其进行stringify()会怎么样?
这样的事情:
var JSONData = JSON.stringify( data );
var params = [JSONdata, deviceid, token];
var newParams = {"params" : JSON.stringify( params )};
resourceRequest.sendFormParameters( newParams )
我认为您必须使用JSON.parse()Javascript适配器中的数据变量。当我有机会的时候,我会尝试一下......
-Paul Horan -