What the App is it that package name is android? - android

I have a list of package name that executed my app.
and the list is like this.
android (?)
com.gau.go.launcherex
android (?)
I confused I never seen this package name (android).
anyone has idea? thx for help.
here is the code to make list of package name
Uri ref = getReferrer();
if (ref != null) {
String host = ref.getHost();
if (host != null && !host.equals("")) {
boolean isWhite = false;
for (String item : whitelist) {
if (item.equals(host)) {
isWhite = true;
break;
}
}
if (!isWhite) {
// add to list
}
}
}

which package you've never seen? can you post more complete log and code which logged these lines? com.gau.go.launcherex is available HERE in Google Play, this is device launcher (what is launcher in HERE). and simple android package may mean app is bring-back from background using some system option, e.g. recents button/menu
edit due code posted in question - some suggestions: instead of for loop just use whiteList.contains(host), if you need to null/empty check host String then use TextUtils.isEmpty

Related

Get package name of apps running in foreground (Kotlin)

I have been struggling with an issue where I want to access the package name of apps
running in foreground and not being the same app as mine. But as far as I am concerned
it is not possible as long as I have to give a local Context parametrized into the method
which returns exactly that.
Therefore I wanted to ask if there is a way of doing exactly this but not only on my App itself but globally?
I tried doing this from another StackOverflow thread:
fun getCurrentForegroundRunningApp(context: Context): String {
val am = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val appProcesses = am.runningAppProcesses
for (appProcessInfo in appProcesses) {
Log.i("For all:: ",""+appProcessInfo.processName)
if (appProcessInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
return appProcessInfo.processName
} else {
return "There is no app in the foreground"
}
}
return "No App in the foreground"
}
I expected for example that it returns how I am running com.etc.somepackage that isn't what
the app package my app is called is. It only returns such value on my app but not on any other.

accessing data from concurrentHashMap while it gets updated in background android

I have a static concurrentHashMap object which is been updated in background. While it is getting updated, I want to access the values from it in another thread. I am using concurrentHashMap which I understand from the documentation and thinks that it would suit this scenrio
Here is what I am doing
for (Map.Entry<String, ArrayList<property>> entry : alldata.entrySet())
{
udata.put(entry.getKey(), new ArrayList<property>(entry.getValue()));
}
in above code I am updating udata on getting data from server but in background.
While in another thread I am accessing some info out of it ..
for (String s: sTypes)
{
if(jprocess.udata != null)
{
if (jprocess.udata.get(s) != null)
{
if (jprocess.udata.get(s).size() > 0) {
if (xcor < jprocess.udata.get(s).size())
if (xcor != -1) {
allData.add(jprocess.udata.get(s).get(xcor));
}
}
}
}
}
but when I try to access any indexfrom it I can not access anything I hope it is clear what I want..
I already tried ConcurrentHashMap which should work for this situation but may be I did not understand it well..
If you are using ConcurrentHashMap, then there is not point it will not work. I strongly doubt that you are trying to access wrong index or you do not have synchronization between inserting and accessing the particular index.
For that just check the size of udata and value of xcor in your code and in each if condition.
In addition, read this carefully and for sure you will be convinced that ConcurrentHashMap is right solution for your issue.

Can not get Registration ID in Emulator

Hi I am running ADMMessenger sample application provided with SDK.
in which I am not able to get Registration ID in register() method of MainActivity.
Method is like this.
private void register()
{
final ADM adm = new ADM(this);
if (adm.isSupported())
{
if(adm.getRegistrationId() == null)
{
adm.startRegister();
} else {
// final MyServerMsgHandler srv = new MyServerMsgHandler();
// srv.registerAppInstance(getApplicationContext(), adm.getRegistrationId());
}
Log.v("log_tag","Reg_id:: "+adm.getRegistrationId());
}
}
in Log cat I am always getting Reg_id:: null
and onRegistrationError() method of SampleADMMessageHandler is calling.
and error at there is ERROR_SERVICE_NOT_AVAILABLE
I can not understand what is problem, please help me.
For the service to work correctly you need to be using the Kindle image (not a generic Android one) and also make sure you have logged into your account on the device (pull down the status bar at the top and ensure you have selected an account)

Add android.permission.CALL_PRIVILEGED in contacts has the error

It has the android.permission.CALL_PRIVILEGED in contacts of android4.0.4. But it still has the error:
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL_PRIVILEGED dat=tel:xxx flg=0x10000000 cmp=com.android.phone/.PrivilegedOutgoingCallBroadcaster (has extras) } from ProcessRecord{41878ad0 3991:com.android.contacts/10000} (pid=3991, uid=10000) requires android.permission.CALL_PRIVILEGED?
I have modified Contacts and repack and signature, then install apk. When I dial it has the error.
I also add <uses-permission android:name="android.permission.CALL_PHONE"/>in AndroiManifest.xml Application.
This is the related code:
public void dialButtonPressed() {
if (isDigitsEmpty()) { // No number entered.
if (phoneIsCdma() && phoneIsOffhook()) {
// This is really CDMA specific. On GSM is it possible
// to be off hook and wanted to add a 3rd party using
// the redial feature.
startActivity(newFlashIntent());
} else {
if (!TextUtils.isEmpty(mLastNumberDialed)) {
// Recall the last number dialed.
mDigits.setText(mLastNumberDialed);
// ...and move the cursor to the end of the digits string,
// so you'll be able to delete digits using the Delete
// button (just as if you had typed the number manually.)
//
// Note we use mDigits.getText().length() here, not
// mLastNumberDialed.length(), since the EditText widget now
// contains a *formatted* version of mLastNumberDialed (due to
// mTextWatcher) and its length may have changed.
mDigits.setSelection(mDigits.getText().length());
} else {
// There's no "last number dialed" or the
// background query is still running. There's
// nothing useful for the Dial button to do in
// this case. Note: with a soft dial button, this
// can never happens since the dial button is
// disabled under these conditons.
playTone(ToneGenerator.TONE_PROP_NACK);
}
}
} else {
final String number = mDigits.getText().toString();
// "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated
// test equipment.
// TODO: clean it up.
if (number != null
&& !TextUtils.isEmpty(mProhibitedPhoneNumberRegexp)
&& number.matches(mProhibitedPhoneNumberRegexp)
&& (SystemProperties.getInt("persist.radio.otaspdial", 0) != 1)) {
Log.i(TAG, "The phone number is prohibited explicitly by a rule.");
if (getActivity() != null) {
DialogFragment dialogFragment = ErrorDialogFragment.newInstance(
R.string.dialog_phone_call_prohibited_title);
dialogFragment.show(getFragmentManager(), "phone_prohibited_dialog");
}
// Clear the digits just in case.
mDigits.getText().clear();
} else {
final Intent intent = newDialNumberIntent(number);
if (getActivity() instanceof DialtactsActivity) {
intent.putExtra(DialtactsActivity.EXTRA_CALL_ORIGIN,
DialtactsActivity.CALL_ORIGIN_DIALTACTS);
}
startActivity(intent);
mDigits.getText().clear(); // TODO: Fix bug 1745781
getActivity().finish();
}
}
}
Who knows the reason? Thanks in advance!
Please delete your apk from /system/app and /data/app, and then
use adb shell pm clear com.android.contacts to clean the data,
finally use adb push command to install your apk.
Good luck.
android.permission.CALL_PRIVILEGED is not available to 3rd party developers. It's used internally by system apps like the dialler.
This would work if you had a rooted phone and the user installed your app as a System app.
See here for more information

android usage of "controller.query(activity);" in scoreloop

i am attempting to implement a built in controller that is part of the scoreloop library. the documentation states:
Basic Usage:
To invoke the TOS dialog if it was not accepted previously, the following code may be used:
final TermsOfServiceController controller = new TermsOfServiceController(new TermsOfServiceControllerObserver() {
#Override
public void termsOfServiceControllerDidFinish(final TermsOfServiceController controller, final Boolean accepted) {
if(accepted != null) {
// we have conclusive result.
if(accepted) {
// user did accept
}
else {
// user did reject
}
}
}
});
controller.query(activity);
but when i paste this into my code i get the following syntax errors:
am i using this incorrectly? how and where would this be used any ideas?
EDIT: after moving the statement to the method where i want to show the dialog i now get the following error:
You seem to be calling controller.query(activity) in a class body where a declaration is expected. Move the statement controller.query(activity) to a method where you would like to show the dialog.

Categories

Resources