I googled _ctx is Null and I was shocked to find nothing relating to Android. I am hoping this pose will help someone if we find the right answer.
Here is a link to the ANE I am using: https://github.com/pozirk/AndroidInAppPurchase
I have no idea where to go from here. It once worked now its not. :(
I am trying to use Pozirk's InAppPurchase.ane - which I have used before but suddenly its not working. I am not sure what changed. It may be, the ANE, or something in google play. Not sure but now its not working and I keep on getting this error:
_ctx is null.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.pozirk.payment.android::InAppPurchase/init()[C:\Users\blah\blah\Android\com\pozirk\payment\android\InAppPurchase.as:46]
at hereWeGo_fla::MainTimeline/fl_MouseClickHandler()[hereWeGo_fla.MainTimeline::frame1:97]
import com.pozirk.payment.android.InAppPurchase;
import com.pozirk.payment.android.InAppPurchaseEvent;
import flash.display.MovieClip;
/**
* ...
* #author Ben Barnard
*/
var _iap:InAppPurchase;
_iap = new InAppPurchase();
_iap.addEventListener(InAppPurchaseEvent.INIT_SUCCESS, onInitSuccess);
_iap.addEventListener(InAppPurchaseEvent.INIT_ERROR, onInitError);
_iap.addEventListener(InAppPurchaseEvent.PURCHASE_SUCCESS, onPurchaseSuccess);
_iap.addEventListener(InAppPurchaseEvent.PURCHASE_ALREADY_OWNED, onPurchaseSuccess);
_iap.addEventListener(InAppPurchaseEvent.PURCHASE_ERROR, onPurchaseError);
_iap.addEventListener(InAppPurchaseEvent.CONSUME_SUCCESS, onConsumeSuccess);
_iap.addEventListener(InAppPurchaseEvent.CONSUME_ERROR, onConsumeError);
_iap.addEventListener(InAppPurchaseEvent.RESTORE_SUCCESS, onRestoreSuccess);
_iap.addEventListener(InAppPurchaseEvent.RESTORE_ERROR, onRestoreError);
// Liscense Key
function onRestoreError(e:InAppPurchaseEvent):void
{
trace("Restore Error - " + e.toString());
outputField.text = "Restore Error - " + e.toString() + e.data.toString();
}
function onConsumeError(e:InAppPurchaseEvent):void
{
trace("Consume Error - " + e.toString());
outputField.text = "Consume Error - " + e.toString() + e.data.toString();
}
function onConsumeSuccess(e:InAppPurchaseEvent):void
{
trace("Consume Success - " + e.toString());
outputField.text = "Consume Success - " + e.toString();
// ------------------------------- THIS LINE PROMPTS THE USER TO PURCHASE THE ITEM ------------------------------- //
_iap.purchase("android.test.purchased", InAppPurchase.TYPE_INAPP);
}
function onPurchaseError(e:InAppPurchaseEvent):void
{
trace("Purchase Error - " + e.toString());
outputField.text = "Purchase Error - " + e.toString();
}
function onRestoreSuccess(e:InAppPurchaseEvent):void
{
trace("Restore Success - " + e.toString());
// ------------------------------- THIS LINE CONSUMES THE "TEST" ITEM ------------------------------- //
_iap.consume("android.test.purchased");
}
function onPurchaseSuccess(e:InAppPurchaseEvent):void
{
trace("Purchase Successful - " + e.data.toString());
outputField.text = "Purchase Successful - " + e.data.toString();
}
function onInitError(e:InAppPurchaseEvent):void
{
trace("Init Error - " + e.toString());
outputField.text = "Init Error - " + e.toString();
}
function onInitSuccess(e:InAppPurchaseEvent):void
{
trace("Init Success - " + e.toString());
outputField.text = "Init Success - " + e.toString();
// ------------------------------- THIS LINE RESTORES ALL PURCHASED ITEMS ------------------------------- //
//_iap.restore(InAppPurchase.TYPE_INAPP);
}
init.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
_iap.init("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiM0Lpjf/S5JQOh0L5c3IQNawziFTT9WeJ9fAmQl5nXJdfVnRK9+mMCnHJlKz8omt9RljlrtLpOV4iy+/KUFgtZ/SCvF+Brpk9lAEe+SbifT2mNGNKgF3tCXSHTXX2Xuq9kw1CR0bDy0Jf36LE04zBo4jYV4RcWQ66ViS2JbTEXAugG5S71z+CJXo6o5uYG/mRZlHFRJkpp1ufDFg4dp8r2ApN3RXhMv9Rl3NCcwTk3R0/rmwCc80Uy94kX7hkgeBuj/AViFZMbzYzY8YLdx80cYYHPc/ofecXmCl6OorJiBC+GiMs/vBoyjr4EGeIqfp1WdZrxeaJzMzAWPNoY4mSwIDAQAB");
}
purchase.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
function fl_MouseClickHandler_2(event:MouseEvent):void
{
//_iap.restore(InAppPurchase.TYPE_INAPP);
_iap.purchase("android.test.purchased", InAppPurchase.TYPE_INAPP);
}
consume.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void
{
//_iap.restore(InAppPurchase.TYPE_INAPP);
_iap.consume("android.test.purchased");
}
restore.addEventListener(MouseEvent.CLICK, rLove);
function rLove(event:MouseEvent):void
{
//_iap.restore(InAppPurchase.TYPE_INAPP);
_iap.restore(InAppPurchase.TYPE_INAPP);
}
You did not add ANE file to your project properly.
This question was already asked and answered:
http://inside.pozirk.com/2013/02/18/adobe-air-in-app-purchase-native-extensions/#comment-87
http://inside.pozirk.com/2013/02/18/adobe-air-in-app-purchase-native-extensions/#comment-89
My checklist, after tinkering FlashBuilder for 2 hours:
1) "project" > Properties > ActionScript Build Path > Native Extensions > Add ANE > "add InAppPurchase.ane"
2) "project" > Properties > ActionScript Build Packaging > Google Android > Native Extensions > "select package InAppPurchase.ane"
3) ... AS3 code uses the in-app-purchase API ...
4) The ANE seems to fail if you try to use it in debug mode; an exported APK should be used instead.
5) FlashBuilder > Project > Export Release Build:
Verify that the ANE is included in the package (Native Extensions)
Verify that your are using the correct signing certificate.
6) Copy the created APK to the Android device.
7) Install the APK using a file explorer.
8) The app finally runs, instead of crashing/hanging at startup.
Related
I am trying to hook function of android messaging application.
I run frida hook script. then I get a following error:
Error: java.lang.ClassNotFoundException: Didn't find class "i0.a.a.a.e3.z" on path: DexPathList[[/data/app/xxxxx==/base.apk]]
In Jadx-Gui, base.apk is decompiled as follows
package i0.a.a.a.e3;
/* loaded from: classes5.dex */
public final class z {
}
script is as follows
let z = Java.use("i0.a.a.a.e3.z");
How can I solve this error?
Try running your hook inside the Java.perform() method of Frida.
Java.perform(function() {
let z = Java.use("i0.a.a.a.e3.z");
z["somefunction"].implementation = function (str) {
console.log('somefunctionis called' + ', ' + 'str: ' + str);
let ret = this.somefunction(str);
console.log('somefunctionret value is ' + ret);
return ret;
};
})
It solved my problem that was similar to yours.
I follow Google's official instructions to use the example of MultiClientInputMethodManagerService(https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/inputmethod/multi-client-ime.md)
The AOSP11 emulator with perDisplayFocus has been built, the screenshot you can see that
enter image description here
But the ime's window only shows on main display, and can only input on the main displayenter image description here
I have added some log to see the multi input window , it seems like has shown
#Override
public void onShowSoftInput(int flags, ResultReceiver resultReceiver) {
if (DEBUG) {
Log.v(TAG, "onShowSoftInput clientId=" + mClientId + " flags=" + flags);
}
final SoftInputWindow window =
mSoftInputWindowManager.getSoftInputWindow(mSelfReportedDisplayId);
if (window == null) {
return;
}
if (mClientId != window.getClientId()) {
Log.w(TAG, "onShowSoftInput() from a background client is ignored."
+ " windowClientId=" + window.getClientId()
+ " clientId=" + mClientId);
return;
}
window.show();
Log.v(TAG, "is showing"+window.isShowing());
}
The logcat of AndroidStudio enter image description here
I search on Google and has not found relevant questions for a long time.Has anyone used this ,thank you very much for the experienced answerers
i had solved it , anyone who sees this problem can refer to my solution https://github.com/Superpengun/MultiDisplayInput
The jar used in the project is extracted from the aosp12 compiled classed.jar ,the keyboardview is a dialog,maybe there is a difference of dialog's Multi-screen display. In the github's project i rebuild the jar for hidden api of AOSP12 and verfied it
I'm using ngCordova inside an Ionic mobile app. In one of my services, I need to delete files I've written previously with $cordovaFile
remove: function (card) {
//remove a card from the store
var index = cardStore.indexOf(card);
if (index > -1) {
//remove the image files
$ionicPlatform.ready(function () {
if (card.imgFrontUrl) {
$cordovaFile.checkFile(cordova.file.externalRootDirectory, "vid-front-" + card.id + ".jpg").then(function () {
$cordovaFile.removeFile(cordova.file.externalRootDirectory, "vid-front-" + card.id + ".jpg").then(function (result) {
console.log("File '" + card.imgFrontUrl + "' deleted", JSON.stringify(result));
}, function (err) {
console.error("Failed to delete file '" + card.imgFrontUrl + "'", JSON.stringify(err));
});
}, function(err) {
console.log("File '" + card.imgFrontUrl + "' does not exist", JSON.stringify(err));
});
}
Everything claims to be successful. In my logs, I see:
14 337901 log File 'cdvfile://localhost/sdcard/vid-front-49444.jpg' deleted, {"success":true,"fileRemoved":{"isFile":true,"isDirectory":false,"name":"vid-front-49444.jpg","fullPath":"/vid-front-49444.jpg","filesystem":"<FileSystem: sdcard>","nativeURL":"file:///storage/emulated/0/vid-front-49444.jpg"}}
At this point I think it's a bug in $cordovaFile or other platform issue.
Any ideas out there?
Short answer: it works on the device. But if you're viewing the files on the device through MTP (e.g. mounted through Windows Explorer), you may not see the change reflected immediately or at all until a device restart. Use a file browser app on the device as a sanity check instead if you're facing this issue.
I am using Microsoft Sync Framework to sync the details from the Datadictionary on android device with SQL Server. Initially get success to sync all data from sql server. But after adding some data and when clicking on the Sync button getting the following error. Can you please tell me is anybody came across this?
[Sync Error]:Error occurs during sync. Please check logs below.
[Upload Change Response Error]: 500 Response: <ServiceError xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Synchronization.Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ErrorDescription>System.InvalidOperationException
serverBlob is empty
at Microsoft.Synchronization.Services.SqlProvider.SqlSyncProviderService.ApplyChanges(Byte[] serverBlob, List`1 entities)
at Microsoft.Synchronization.Services.UploadChangesRequestProcessor.ProcessRequest(Request incomingRequest)
at Microsoft.Synchronization.Services.SyncService`1.ProcessRequestForMessage(Stream messageBody)
</ErrorDescription></ServiceError>
In the below code, i'm getting xmlHttp.status=500 when clicking on the Sync button
this.sendRequest = function (serviceUri, successCallback, errorCallback, dir) {
TraceObj("[" + dir + " Request]:", serviceUri, this.dataObject());
// Construct HTTP POST request
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", serviceUri);
xmlHttp.setRequestHeader("Accept", "application/json");
xmlHttp.setRequestHeader("Content-Type", "application/json");
// Handle success & error response from server and then callback
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var res = new SyncFormatter();
if (res.parse(xmlHttp.responseText)) {
TraceObj("[" + dir + " Response]:", serviceUri, res.dataObject());
alert("[" + dir + " Response]:", serviceUri, res.dataObject());
successCallback(res);
return;
}
}
TraceMsg("[" + dir + " Response Error]: ", xmlHttp.status + " Response: " + xmlHttp.responseText);
errorCallback(xmlHttp.responseText);
}
};
xmlHttp.send(this.toString());
};
}
I have found the root cause of the problem. That is when i get the values from datadictionary storage, value has the single quotes in the values so not able to load the values in webview. Now i have replaced single quotes by \'. Now working fine.
I have used webview
with the reference http://developer.android.com/guide/webapps/debugging.html
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebChromeClient(new WebChromeClient() {
public boolean onConsoleMessage(ConsoleMessage cm) {
Log.d("MyApplication", cm.message() + " -- From line "
+ cm.lineNumber() + " of "
+ cm.sourceId() );
return true;
}
public void onConsoleMessage(String message, int lineNumber, String sourceID) {
Log.d("MyApplication", message + " -- From line "
+ lineNumber + " of "
+ sourceID);
}
});
but still m not get log Logcat
Please help me out
It appears some devices (HTC Desire and some others) with specific OS (mine had 2.3.3) do not display messages in Logcat window and it seems console.log does not work for them. I found a nice workaround using JavaScript Interface to overcome the issue: Android Console via JS interface
In my case (I have Samsung Note 4 running Android 6.0), onConsoleMessage is called only if I set
myWebView.setWebContentsDebuggingEnabled(true);
and when I open the Chrome remote device debugger to inspect the webview. But obviously this is not quite helpful since I can already see the console output on the debugger window.