Hi everyone Im trying to post some data to a php script using AppMancer AMDownload
here is my code
#include <MAUtil/Moblet.h>
#include <conprint.h>
#include <AMDownload/DownloadManager.h>
using namespace AMDownload;
using namespace MAUtil;
/**
* A Moblet is a high-level class that defines the
* behaviour of a MoSync program.
*/
class MyMoblet : public Moblet, private DownloadRequestListener
{
public:
/**
* Initialize the application in the constructor.
*/
MyMoblet()
{
printf("Press zero or back to exit\n");
}
/**
* Called when a key is pressed.
*/
void keyPressEvent(int keyCode, int nativeCode)
{
if (MAK_BACK == keyCode || MAK_0 == keyCode)
{
// Call close to exit the application.
close();
}
// Print the key character.
printf("You typed: %c\n", keyCode);
String password = "p45sw0rd";
DownloadRequest* req = DownloadManager::createRequest(this);
req->setUrl("https://acrscore.usa.cc/accounts/test/upload.php");
req->setHttpMethod(HTTP_POST);
req->addPostData("name", "hy");
DownloadManager::enqueue(req);
}
void downloadFinished(DownloadRequest* request){}
/**
* Called when a key is released.
*/
void keyReleaseEvent(int keyCode, int nativeCode)
{
}
/**
* Called when the screen is touched.
*/
void pointerPressEvent(MAPoint2d point)
{
// Print the x and y coordinate.
printf("You touched: %i %i\n", point.x, point.y);
}
private:
};
/**
* Entry point of the program. The MAMain function
* needs to be declared as extern "C".
*/
extern "C" int MAMain()
{
Moblet::run(new MyMoblet());
return 0;
}
This is the console output
[28] Emulator connected.
[28] PrintConsole:
[28] Press zero or back to exit
[28]
[28] PrintConsole:
[28] You typed: 4
[28] MoSync Panic 40055. "Attempted to use a resource, but no resources exist." The panic occurred in the syscall maGetDataSize.
[28] IP:0xefda: crtlib.s:1
[28] IP:0x2b0: C:/MoSync/workspace/uu/main.cpp:20
[28] IP:0x2058e: c:/slave/buildScripts/temp_Nnqh/source/libs/MAUtil/Moblet.cpp:89
[28] IP:0x1a704: c:/slave/buildScripts/temp_Nnqh/source/libs/MAUtil/ListenerSet.h:60
[28] IP:0x13f: C:/MoSync/workspace/uu/main.cpp:13
[28] IP:0x1c7: C:/MoSync/workspace/uu/main.cpp:41
[28] IP:0x696a0: C:/MoSync/AppMancer/AMDownload/DownloadManager.cpp:81
[28] IP:0x6952a: C:/MoSync/AppMancer/AMDownload/DownloadManager.cpp:195
[28] IP:0x67ce0: C:/MoSync/AppMancer/AMDownload/HttpDownloader.cpp:68
[28] IP:0x67a75: C:/MoSync/AppMancer/AMDownload/HttpDownloader.cpp:269
[28] Exit @ IP 0x67a73 SP 0x3ffe9c
[28] IP:0x67a73: C:/MoSync/AppMancer/AMDownload/HttpDownloader.cpp:269
I do not understand my im getting
MoSync Panic 40055. "Attempted to use a resource, but no resources exist." The panic occurred in the syscall maGetDataSize.
I’ve set the post data req->addPostData(“name”, “hy”);
Can someone please help me with this?
there is a bug in the first release of AMDownload for MoSync 3.0.1 – sorry about that. There is a correct version for download from http://appmancer.com/download/AMDownload.zip. Extract the two files into your MoSync/lib/pipe folder.