Inconsistency in getInstallerPackageName method in Android [duplicate] - android

My app. is deployed in Play Store as well as Baidu Store. For notificatiions, need to differentiate from where app. is installed.
When I used getInstallerPackageName() method, Redmi Note 3 returns correct value but HTC returns null.
Why is this difference observed ?
Is there any other better way ?

Regarding this answer:
i suggest that when its null then its from Baidu and when its then its from google xD


Check if Android app is a game by packageName

This is a question that I've not been able to fetch from StackOverflow or directly from Google. Is it maybe because I didn't search with the right words?
Well, anyway:
I'm trying to check if an app is a game by its packageName.
What I've researched:
I know the app could be checked if it comes from the Play Store, but what about if it comes from any store?
Inside the PackageInfo, there's the feature PackageManager.FEATURE_GAMEPAD but what about if it doesn't have any GAMEPAD or anything related? just a game of... puzzle for example?.
I know that from API >= 21 you can really check it, but what about the older ones?
Thank you very much in advance.
I'm trying to check if an app is a game by its packageName.
By definition, that is impossible. For example, there is no universal definition of what a "game" is.
I know that from API >= 21 you can really check it
No, you can't, as there is no requirement for a game to have that flag set.
Check the app category in play store
Just parse the page of the play store for that package and get the category it is in. Games have a very distinctive category

Check for system updates on Android devices

I'm looking for any way to check for Android OS updates from within custom Android app.
The app should be able to get info if new version is available and, if so, show appropriate message. This should work on phones provided by many manufacturers. Is there any API method or a web service which can be queried about this?
I know this feature is carrier-depended and that's way I'm not sure if it's even possible.
Thanks in advance.
There is no way to do this. Your app is sandboxed and can't access that kind of information and there is no API from the carrier's end.

Check if android app has a newer version on playStore

I want to know if it is possible to check if the app that the user is running is the latest version that is available at Google PlayStore. I have read some answers and they say that this is not possible, but I see some apps that do this.
Can someone tell me how can I do this? I can see that this is possible.
Indeed the Google Play Services do not expose such API.
But you could use a workaround to check for newer versions: a simple request on your serveur could do, parsing the Play Store page could do too etc.
You can create an api on your server for these kind of operations.
Your api can return values such as currentVersionCode, minVersionCode and an updateMessage.
You can compare your apps version code, currentVersionCode and minVersionCode and show a dialog for nice to update or force update.

Android devices with Google APIs

I know this question may be lame, but I'm trying to find a list of Google API supported Android devices. I just want to know how my app compatibility for certain smartphones will look like. Any ideas?
Well, I realized there is some kind of walkaround solution. You can upload your app on Android Market, save the needed data (screenshots, app name etc.) and activate it (NOT publish) and then in app info, just below the list of countries you support, there is a detailed information about devices on which the app should run (and not). I don't know if it works 100% properly, but sure it gives a little bit of help.
Phones that do have or will be getting Gingerbread (might be out of date now?)

android licensing could not bind to service

I'm trying to implement android licensing and keep getting an error in the log that could not bind to service.
I am having similar problem as this link
Android Context.bindService always returns false and ServiceConnection object is never triggered
but the solution did not work. I have gone all the way back to the android sample app and I'm getting the same error no matter what context I try and when I make no changes to the sample. Does the service need to be in the manifest, it is not in the sample. I was thinking maybe it had something to do with the library? I have tried this with the library using 1.5 and then with android 2.1 and 1.5 in the emulator, in all cases same issue, service will not bind...
I determined the issue was not my source code, it was the ways I was trying to test it. For the simulator, you need to be using either Google API 8 or higher or have market installed to get the service to bind, I just used Google API 8 and it seems to work fine. On my device I am still not sure exactly why it is failing, it is version 2.3 and it works fine with my primary account logged in, but the other logins do not seem to work that I added in the developer console. I suspect it is because the APK is not yet uploaded, but still not sure why it works for my account but not theres...