Android Question Intent from inside Library Help

walterf25

Expert
Licensed User
Longtime User
Hi All, i'm updating a library which was working great before, but the vendors released a new SDK and they are now sending the intents from within the library, i followed this thread here but i am having problems, when i send a command which is supposed to open an Admin Menu, I see in the logs Activity_Pause and Activity_Resume but nothing shows up, i am expecting a different activity pop up which would show the Admin Menu.

On the code below,
Intent:
try {
         ba.startActivityForResult(ion, null); //<-- passing null instead of an intent
      } catch (NullPointerException npe) {
         //required...
      }
      BA.SharedProcessBA sba = ba.sharedProcessBA;
      try {
         Field f = BA.SharedProcessBA.class.getDeclaredField("onActivityResultCode");
         f.setAccessible(true);
         int requestCode = f.getInt(sba) - 1;
         'requestCode holds the value that should be used to send the intent.
      } catch (Exception e) {
         throw new RuntimeException(e);
      }

Where it says requestCode holds the value that should be used to send the intent, what does this mean exactly and how do I use the requestCode?

I am a bit confused on that part, i don't get any errors, except that the
BA.SharedProcessBA sba = ba.sharedProcessBA; part shows that sba is null, but I handled that part by checking first if null and then setting sba = mba.

Any help to get passed this issue would be greatly appreciated.

Thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
This code is not relevant for the first step. If the library code sends an intent then another app or activity should start. The next step is to intercept the result.
Is there anything else I should be doing then, when I send the command that is supposed to send the intent to open up the Admin Menu, i don't see anything popping up, I do however see in the logs that the Main Activity pauses then it Resumes, as if something is happening, any advice, is there anything that should be added to the Manifest file?

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
How should we know? You are not providing any information about the library you are wrapping, their documentation or example app.
I meant in general, I mean sending an Intent to open another Activity is pretty straight forward, my question is, what could cause the intent not to work, (ie Activity no open).

Walter
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I would start checking their docs, evaluating the example, check if there is anything which is needed in the manifest (the example probably has a special manifest if it is needed).
I would also check the unfiltered log to see if there is any error.

my question is, what could cause the intent not to work, (ie Activity no open)
Sorry, i can´t answer this question.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Thanks, I already went through their example and their documentation and don't see anything, i'll keep trying, i'm sure it must be something simple that i may be missing.

Walter
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Make sure to check the unfiltered logs.
The new Thread is here
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Make sure to check the unfiltered logs.
The unfiltered logs are these:
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Why are you making duplicate posts?

We cannot really know why the target activity wasn't started. It is not related to the handling of the result.
It seems to me unless I'm interpreting the unfiltered logs wrong, that the target activity is started but it gets destroyed, but not sure why that would be, I do see from time to time a white screen that pops up but goes away really fast.

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Do they provide an Android Studio example? If so, try it. Once you get it working it will be easier to understand the differences.
Yes, I already tried running the Android Studio Example and it works fine, which is why I don't understand why it doesn't work from the wrapped Library, everything is the same, I don't see anything different.

Walter
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…